11Sep/16

Check if a String is a Balanced String

A balanced String is a String with equal number of opening and closing matched brackets. In other words, an expression consisting of matching opening and closing brackets are called balanced strings. For instance, “adf(aew)23[34v3a*23]ade(we{wefave}qwef)ad[e[qew]]” is a balanced string, because after removing all the characters it is left with “()[]({})[[]]”.
Continue reading

18Jul/16

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

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: Continue reading

29May/16

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.
Continue reading

15May/16

Understanding Docker – Why, What and How to use it!

Suppose you write a text file and wish to open this text file into another environment. Then sometimes it comes up with a warning that this text font is not supported in this environment. But meanwhile you convert that text file into a pdf format and then open the same pdf in another environment. That pdf file have no issues with the environment. Like wise, with the docker, it binds up the different IT operations like code, system libraries, system tools, runtime. It runs on server without any leakage i.e. a full proof solution to server deployment. So, this post is about understanding docker installation and usage.
Continue reading

17Oct/15

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

Continue reading

05Oct/15

EditText with Single Line, Line Wrapping and Done Action in Android

Regular formula for making an EditText
– Single Line : no new line <Enter> allowed,
– Line Wrapping : Single line wrapped into multiple lines, and
– Done Action : imeAction set as actionDone

is possible through only XML properties. That is,

But, only this is not enough. You need to set all these properties programatically.
Continue reading

05Oct/15

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.

Continue reading