For an object, we can specify the access control of the object means which users are allowed to read the object and which users are allowed to write.
To do this, each object has an access control list. Parse provide ParseACL class to handle al...

To reset the password, Parse provide us RequestPasswordResetCallback to requesting a password to reset for an existing user.
I implement it using anonymous inner class. So then override the done() method where we can do whatever we want after ...

The problem that I find when I used toolbar was the default left margin of the toolbar.
Basically its left inset, and it is caused by Toolbar's contentInsetStart.
left inset of the Toolbar is by default 16dp so we see such margin on the...

In android, switch is the toggle widget that has two states to select two options.
User can simply click to toggle or drag back and forth to select the option.
Here, I am changing the ON color of the SwitchCompat. SwitchCompat is the versio...

The problem that I encountered when showing images in ListView from Parse.com is catching because we get ParseFile from cloud.
So I first change ParseFile to byte[] and then use Glide library that allow byte[] also to load image.
Gl...

If we need to show countdown till in some point of time in future then CountDown timer is the best solution
CountDown Timer sets countdown till in some point of time in the future, with regular interval.
CountDownTimer is the class that han...

There are certain situations when we need to turn screen ON such as live map games, routing, movie, tv apps.
Basically, to avoid battery draining android device fall asleep after some time, but to accomplish this task we have to keep screen ON...

When our application and libraries references reaches their limits, then we get some errors that shows we reached the limit of built architecture.
Like this
trouble writing output:
Too many field references: 131000; max is 65536.
You may ...

If we don't specify we require camera using manifest declaration, so we can check it at runtime that the camera is available or not.
To do this task, we have PackageManager class.
PackageManager has hasSystemFeature() method to check it...

After creating a ViewPager (as I also described here ViewPager) we need to catch the changing of slides event.
To do this we have a listener OnPageChangeListener i.e, ViewPager.OnPageChangeListener that invokes whenever we chance the page or i...

To show slides of images, we use ViewPager in android that provided by the support library.
First of all add images that we want to show in drawable folder.
Then create array of these images.
private int[] mResources = {
...

Scala is a programming language and full form is Scalable language. It first released in 2003.
Scala is object-oriented and functional language. Many companies that depend on Java switching to Scala to enhance their development productivity, s...

To replace any character from a String, we generally use replaceAll() method of String.
Below is the example
String Str = new String("Hello + world +");
System.out.print("Output Value :" );
System.out.println(Str.replaceAl...

I am writing code to copy specific content on any event.
Android provides clipboard-based framework to do this task.
Clipboard is represented by ClipboardManager class. To instantiate it, we need to call getSystemService(CLIPBOARD_SERVICE)
T...

Pop up menu simply show Menu in a pop up window anchored to a View.
It displays the pop up below the anchor view if it finds space otherwise above the anchor view.
If we touch outside of it, then it will dismiss the pop up menu.
First, w...

When we login through parse.com so at the time of logout, we need to clear the current user.
We need to simple use method logOut() of parse.
Below is the code
ParseUser.logOut();
ParseUser currentUser = ParseUser.getCurrentUser(); // ...

I found that sometimes button showing text in upper case.
I have found the solution that we just need to define property textAllCaps in the xml file.
For example
<Button
android:layout_width="match_parent"
...

Hello,
It is very simple to delete an item or row from any parse table from the code.
First, we need to create the object of the table that points that particular row and then delete it.
I create an object using object id and t...

Here I am writing the way to change the color and icon of FloatingActionButton.
If I talk about icon of the action button, we need to fulfill of requirement and purpose of Floating button.
So we need to change the icon of the FloatingActionBu...

Below is the code to adjust ImageView taking full width.
It is mainly required when we need to show cover photos which take the full width of the screen.
The images that are in landscape looks ok, but we find a problem with the portrait pic...

Sometimes we need to open user profile of Facebook, Twitter or LinkedIn by using the username in android.
To do this, we just create a uri to open the profile.
We can implement this in onclick() of any view.
For Facebook:
String url =...

Here I am sharing a custom progress bar to show loading.
First of all, we need to define it in gradle file
compile 'com.victor:lib:1.0.2'
Then in xml file:
<com.victor.loading.rotate.RotateLoading
android:id="@+id/loa...

Below is the code to find an address in String by using latitude and longitude.
I am using Geocoder class and method getFromLocation() of Geocoder class.
We need to pass latitude, longitude in double format and integer value of the maximum nu...

Basically we have two options for selecting the duration of the Toast.
First is SHORT duration, which is 2 seconds and another is LONG duration that is 3.5 seconds.
We cannot change the duration of the Toast directly.
To change the time of...

It is very important to know the difference between all of them.
We have to make sure that existing apps built against prior SDKs should not break when the user
updates to a new version.
compileSdkVersion:
It says the Gradle about version of ...

Below is the code to read a text file from SD card.
First, we have to define path of the text file to a File.
Second step is to use BufferedReader class to read line by line.
File sdcard = Environment.getExternalStorageDirectory();
...

If we want to update UI from a Non-UI thread then runOnUiThread() is the best solution for it.
I am showing Toast in every 25 secs.
Below is the code
private Thread refreshThread;
refreshThread = new Thread() {
@Override
...

Mostly when we logout from an application, we want to come to the login screen and clears all the stack of the Activites.
So for this requirement, we just need to use FLAG_ACTIVITY_CLEAR_TOP in addFlags() method.
Below is the code
Intent...

I am removing duplication from arraylist. To do this, first add all the items of arraylist to a HashSet.
HashSet takes only unique items.
Finally, take HashSet items to the arraylist.
List arrayList = new ArrayList<>();
arrayList.a...

Below I am writing a method that will hide the soft keyboard in android.
I just use hideSoftInputFromWindow() method of InputMethodManager in this method.
public static void hideKeyboard(Activity activity) {
//start with an 'al...

It is very easy to set up parse.com to anroid project.
After setting up, you can create your own backend very easily.
First of all define dependency on gradle file
dependencies {
compile 'com.parse:parse-android:1.10.2'
}
After this,...

It is very easy to get the url of profile picture from facebook if we have user id.
We just create a url like this:
Here id is the user id of the Facebook account.
try {
// Type may be normal,large or small
...

Here I am writing few differences between UnBound Service, UnBound Service and IntentService.
UnBound Service:
1.Basically used for long repetitive task.
2.startService() is the method use to start unbound service.
3.stopService()...

To implement "OR" feature on the query we need to merge two queries.
First, create a list of queries and add the queries that you want to implement.
And then ParseQuery.or() methods to make a final query.
Below is the code
ParseQuer...

In many situations, we need to add swipe menu functionality to make our listview attractive.
Here I am using a library that makes it so simple.
Firstly, we need to add a dependency to gradle file
compile 'com.baoyz.swipemenulistview:libr...

Here, I am writing simple method to find out the number of days between two dates.
In many situations, we need to calculate it. So just pass two dates as parameters of the method and get the number of days in long data type.
publ...

Hi,
It is one of the important topics in java.
For dynamically resizable array we use ArrayList. ArrayList provides us fast access as compare to simple
array.
1. As we go to synchronization, Vector is synchronized means at a single time o...

Hi,
I am explaining the difference between HashSet and TreeSet in Java.
First of all they both come from the same family. They implement the Set Interface.
In HashSet, values store in random order. That means it is not sure that the ele...

Sometimes, we need to change some special character on String to fulfill our requirements.
For example, we need to show phone number, i.e, 2001256443 as (200)-125-6443
Now we use the substring method of String to solve it.
We just add Stri...

Here I am writing code to load url on WebView.
We need to create WebView client where we get the event of page finished.
Then simply showing ProgressDialog and dismiss it on onPageFinished().
WebView myWebView ;
myWebView = (WebV...

I am writing way to add and use date Picker Material design library to our project.
First of all we need to add library to our build.gradle file
dependencies {
compile 'com.wdullaer:materialdatetimepicker:1.5.4'
}
Then we need to imple...

Sometime, we need to remove or replace some particular character from a String.
Below is the method by which we can accomplish this. I am using replaceAll() method of the String.
replaceAll() have two parameter as an arguments. First one is t...

It is very easy to retrieve image file from parse.com.
For example the image file name profilePicture is save on User class and I am going to retrieve the image below.
ImageView profilePic = (ImageView)findViewById(R.id.image_profile);
P...

To reset ArrayList we have two options, one is to use clear() method and another is to use removeAll().
We dont need to worry if size of the ArrayList is small i.e. 10 to 100.
But if ArrayList size becomes huge the difference in the performan...