Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 

Object Security parse.com android

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

Calling a ParseCloud function from android parse.com

Here I am writing the way to call cloud method from the code. Below is the method in the parse cloud. Parse.Cloud.define("testing_method", function(request, response) { var textMsg = "Testing 1 2 3"; var jsonObject = { "answerM...

Forgot Password through parse.com

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

How to remove left margin of Android Toolbar?

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

Change the color of Switch

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

Catching while showing images using ParseFile through parse.com

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

Count down timer that shows in HH:MM:SS format

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

Keep the Screen On

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

Multidex with Gradle

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

Detecting camera hardware

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

How to catch changing of View Pager slides

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

Image slides using ViewPager

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

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

replaceAll() to replace square brackets in a String

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

Copy Text from android application

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 Android

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

Logout parse.com android

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(); // ...

Button always showing text in uppercase-solution

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" ...

Delete a row from a table in parse.com

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

How to change icon and color of FloatingActionButton

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

ImageView takes Full Width

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

Open facebook, twitter and linkedIn user profile using username

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 =...

Custom Rotate Loading

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

Getting Address using Latlong

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

Showing Toast for a specific duration

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

CompileSdkVersion, minSdkVersion and targetSdkVersion

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

Read text file from SD card

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(); ...

runOnUiThread() in android

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

How to split an Image in android

I am facing problem to split an Image. Please help me to find out the solution. Please share any library if you know.

How to take frame from video

Please provide me the solution to take frame from video in android If you have code. Please share it.

DDMS in android

What is DDMS in android? Could you please provide the capabilities and functionalities of DDMS?

Clear android activity stack starting a new activity

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

Remove duplicate items from ArrayList.

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

Hide Soft keyboard in android

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

Set up parse.com BaaS to android project

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,...

How to make a view transparent

Below is the solutions to make transparent view. 1. Using android predefined color android:background="@android:color/transparent" 2. Create own color <color name="transparent_color">#80000000</color> 3. D...

Get Facebook profile pic url by user id using graph api

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

Vibrate Animation to ImageView

To give imageview / button vibrate animation, need to follow these steps. create xml file "vibrate_anim.xml" in anim folder <!--?xml version="1.0" encoding="utf-8"?--> <rotate xmlns:android="http://schemas.android.com/ap...

ArrayList is not synchronized

What does it mean when we say an ArrayList is not synchronized?

Difference between UnBound Service, Bound Service and Intent Service

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()...

ListView populate from bottom

To populate a listview from the bottom, we just need to add the attribute stackFromBottom on listview from xml file. Then set it to true like this <listview android:stackfrombottom="true"> </listview>

Multiple Combined Or Queries using Android Parse Android

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

Swipe to delete to ListView items in android

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

Find Number of days between two given dates

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

Difference between ArrayList and Vector

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

Difference between HashSet and TreeSet

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

Add any character to String on a particular location

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

Show loading when load page on WebView

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

Date Picker Material Design

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

Remove some particular character from a String

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...
prev 1
Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: