Android

How to add common utility for Android application in Android Studio


Hi Friends,Today I am going to share one utility class which I have created and using in my projects to simplify my common utility requirements.

I have created one Util class and created my methods as static which helps in accessing these methods without class objects.

Just call MyUtils.methodname(context) to access the method from any where from your app. Short Description: Call MyUtils.readJsonForMe(context) to access these methods.

I have created the test_json file inside raw directory with following content: To create raw directory:Right click on raw–>choose create resource directory and name it as raw and place your test.json file inside it.

Top 10 free Android libraries for app development in android studio

{“employees”:[ {“firstName”:”John”, “lastName”:”Doe”}, {“firstName”:”Anna”, “lastName”:”Smith”}, {“firstName”:”Peter”, “lastName”:”Jones”} ]}

Feeling glad to receive your comment