Author name: Catalin Prata

Born in Alba Iulia, a beautiful city from Romania. I like hiking and everything related with electronics and IT . Eager to learn and enhance my knowledge in programming languages. My main specialization is on Mobile Applications development (Android and iOS).

Snippets, Solutions

Print Android signing key SHA in code

If you ever want to get the Android SHA (1/256), MD5 or the signing key used to sign your app for example you can use the following snippet. Important! Be aware that you should not print that in a production environment as it might leak sensitive data API 28> (Kotlin) Deprecated (Java) And the converter […]

, , , , , , , ,
Snippets, Solutions, Tutorial

Add links to a TextView in Android

Maybe you need to add links to a TextView on Android but you don’t want to use Linkify for some reasons and you also want that link to be opened when the user taps it. Here is a simple solution: yourTextView.setText(Html.fromHtml( “Text with a ” + “<a href=\”http://www.myandroidsolutions.com/\”>link to My Android Solutions</a> “)); // this is

, , , ,
Snippets

Get Android OS Version

If you ever need to get the version of the OS on which your app runs, you can try this out: android.os.Build.VERSION.SDK_INT And you can use it against(for more check this out): android.os.Build.VERSION_CODES.[BASE-KITKAT]   Finally you end up with something like: if(android.os.Build.VERSION.SDK_INT == android.os.Build.VERSION_CODES.HONEYCOMB){ // do whatever you want here }

, , ,
Snippets, Solutions

Share image Intent

Whenever you need to share an image from the external storage you can use the startActivity method and an Intent to do that. Doing so, the user will be able to chose whatever app he likes to share the photo. Intent share = new Intent(Intent.ACTION_SEND); share.setType(“image/png”); share.putExtra(Intent.EXTRA_STREAM, Uri.parse(“file:///”+imagePath)); startActivity(Intent.createChooser(share, “Share Image”)); If you don’t append the

, , ,
Snippets

Clear Fragment back stack

To clear the Fragments back stack of a FragmentManager, you could iterate through all back stack items and call popBackStack() but there is also a more elegant solution. Please see below: // in my case I get the support fragment manager, it should work with the native one too FragmentManager fragmentManager = getSupportFragmentManager(); // this

, ,
Tools

Android State list generator

Inspired by a post from stackoverflow, I made a simple XML State List generator :), you simply need to fill the inputs with your corresponding drawable names and then press Generate button. For more details regarding android StateList XML please check the official documentation. Android state list generator version 2 is here:  New in android state list generator

, ,
Tutorial

Android and Java sockets – simple messenger

Hello all, as you requested in the previous TCP server-client tutorials, I made a new tutorial on how to create multiple client connections to a single server. I posted the projects on GitHub here for you so I will post here only the main classes and functionality that I consider important to walk through. You

, , , , , , , , ,
sponsored
Exit mobile version