Open Application Settings Screen Android

In this tip we will see how to open an application setting screen from our application. In some application it might be possible that user has denied permission and you need to open application permission screen in order to get that particular permission, but this is not possible to in this case you need to redirect a user to application setting page and from that user can check for permission settings.

If you want to open a setting screen of other application, you need to replace activity.getPackageName() with a package name of application whose setting screen you need to open.


Concat Two Strings In TextView Using DataBinding

Sometimes we might need a functionality where we needs to concat two strings in xml only. So here are the different ways of how can we do it using databinding.

1. Using grave accent(`)

2. Using strings.xml

and in your string.xml file

Continue Reading

INVISIBLE vs GONE View in Android

Lot of time we have a requirement to hide the view either runtime or from xml. We have seen View.GONE and View.INVISIBLE but very few people knows difference between those two constants.

First we will see what android document says about it.


This view is invisible, but it still takes up space for layout purposes.


This view is invisible, and it doesn’t take any space for layout purposes.

Continue Reading

Disable future dates from DatePickerDialog in Android

As we already know DatePickerDialog will be used to allow user to select date. It is useful when user wants to select Date of Birth or Start Date or End Date etc.

Here is the small code snippet of creating DatePickerDialog.

Continue Reading

getResources().getColor() is deprecated

As we already know getResources().getColor() is deprecated since API level 23 from the official document

So what is the alternative of getColor()?

from API level 23, getColor is added in ContextCompat.

So just call

from official document of ContextCompat.getColor()

Returns a color associated with a particular resource ID

Starting in M, the returned color will be styled for the specified Context’s theme.