Solution: Access to the dex task is now impossible, starting with 1.4.0

Everybody* who wants to upgrade to and above 1.4.0 build tool version is getting this error. Error:Access to the dex task is now impossible, starting with 1.4.0 1.4.0 introduces a new Transform API allowing manipulation of the .class files. See more information: http://tools.android.com/tech-docs/new-build-system/transform-api As you can see by visiting the new build system: transform api that there is no solution provided. Follow the steps to solve the problem Access to the dex task is now impossible: (more…)
Read More

Product Flavors in Android

Environment plays a vital role in the application development. As per the requirements, we have to create few environments, viz. Dev, QA, UAT, and Prod. In some projects, only a subset of these environments is required. So, with different environments comes different API endpoints. But for Android application development, most of the developers are still following the same old concept of enabling the endpoint of one environment and commenting endpoints of the rest of the environments. Now, we have Product Flavors in Android. And, it maintains the build as per the requirement. That is, there is no need to change in code if a build for a different environment is required. (more…)
Read More

Set margins in dp programmatically – Android

Sometimes at runtime, it is required to set margin to a view. But, the problem is getting different size for different screen sizes, i.e. hdpi, xhdpi, xxhdpi, etc. This could be done easily with the help of screen specific value resources. Provide screen specific dimension values/dimen.xml 2dp (more…)
Read More

How to get all values of SharedPreferences programmatically in Android

SharedPreferences stores all values in XML file. So, if you want to iterate through all the values stored in it, you could try following code. public static List getAllValues(Context context) { Map values = getPref(context).getAll(); List prefDataList = new ArrayList(); for (Map.Entry entry : values.entrySet()) { PrefData prefData = new PrefData(); prefData.key = entry.getKey(); prefData.value = entry.getValue().toString(); prefDataList.add(prefData); } return prefDataList; } (more…)
Read More

RecyclerView – Android

In this post, we are going to load the list of posts from PCSalt.com. In our previous post, JSON Parsing – Android, we used ListView to display a list of posts. But, in this post, we are going to use RecyclerView to display it. (more…)
Read More

Create Andriod Application Project in Android Studio

In previous blog, we tried to reason with developers who are still using Eclipse to migrate to Android Studio. Well, here in this post we are going to explain the process of creating project in Android Studio. Even if you are a beginner or you were previously using Eclipse and now wants to switch to Android Studio, this post is for you. (more…)
Read More