Featured
-
Android O Released with Top 7 New Features for App Developers
Android was founded by Andy Rubin, Rich Miner, Nic
by sudhanshu.tripathi -
An Overview of Android Activity - Video Tutorial
As far as Android platform is concerned, the funda
by amit.rai -
How to get IMEI number,serial number and software version of your phone
Hello... Sometimes we need to know the country
by shahbaz.ahmmod -
Search location by using place on google map
Here below is the code for searching places by usi
by shahbaz.ahmmod -
How to know free space in sdcard android
I have written code to know free space in sdcard
by shahbaz.ahmmod
Tags
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 = {
...
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
...
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...
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...
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...
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...
Save Image File on Parse.com Android
Here I am getting image path from Native data
Here IMAGEPATH is the path of image from Camera.
ByteArrayOutputStream stream1 = new ByteArrayOutputStream();
// Compress image to lower quality scale 1 - 100
bitmap1...
Retrieve Image file from parse.com and set on ImageView android
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...
Transparent Button with Border
Here I am writing code to create transparent button with border.
First create xml file transparent_button.xml for selector where I am describing the properties of button like border width, color etc
<!--?xml version="1.0" encoding="utf-8...
Retrieving Objects parse.com android
Hi,
After saving object Saving Object parse.com Android
Now I am writing here how to retrieve object using some key here using objectId.
If you have objectId then it is very easy to retrieve object value.
parseObject use ParseQuery to han...
Saving Object parse.com Android
Hi,
Here I am writing way to save object to the parse cloud.
Parse provides ParseObject to handle to saving object.
ParseObject has saveInBackground() method that need to invoke to save.
Let's consider you have to save EmployeeInfo.
...
Android Parse.com Simple SignIn
Hi,
Here I am writing simple way to login after creating user in parse.
Tutorial for Sign Up
ParseUser handles all sign in and sign up functionality.
We login through logInInBackground() method of ParseUser. We need to pass username and...
Device Art Generator
To show your screenshots of device more attractive and you want to wrap the screenshots in a
particular device artwork so it is very easy.
Visit here
submit png screenshot.
and drag your
screenshot png image in the device which you want t...
Android Parse.com Simple Signup
After set up and integrate parse.com on your project the important thing is to sign up or can say
create users.
Parse provides facility to their users to access their information in a secure manner.
ParseUser is the class that handles muc...
Floating Labels for EditText in Material Design
Hi,
We can show floating label for EditText by using android design support library.
When we input text on EditText, it shows animation by floating labels.
TextInputlayout is newly introduced to show floating label on EditText in design ...
Clipboard Android
Android gives us the facility to copy and paste the data by providing clipboard.
We can copy text, binary stream, images or other data.
Android provides ClipboardManager to handle all this.
We have to instantiate the object of ClipboardMana...
How to generate debug SHA1 in android
Here I write command by which we can get debug SHA1 that is use to generate debug SHA1 in android.
This SHA1 further use for Google Map V2.
Below is the command
keytool -list -v -keystore ~/.android/debug.keystore -alias androidde...
Vibrate Service in android
To make user experience better by providing good focus on some events when volume is not relevant.
Android provide vibrator class to handling all this.
Below is the implementation. It vibrates just for 500 milliseconds.
First of all we ne...