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
How to get Current month name,date and year in android
This example shows how to get / Display the current month, date and year from calendar. To acomplish this I have used Calender.getInstance() method of Calender class. let's see the code example:
protected void onCreate(Bundl...
How to share image that was loaded from a remote url?
Hello Nerds, This tutorial is for forwarding/sharing image from one application to other which was loaded from a remote url. Assuming that you have loaded an image from remote url and displayed it in your ImageView. The basic procedure is by taki...
Introduction to Fresco image loading library for Android Application
Hello Nerds, Are you still facing lazy image loading or OutOfMemoryException using Universal image loader, Picasso, Glide or any other library? If Yes, then this tutorial will be very helpful for you. Fresco image loading library provides quick l...
Activity state transition when going from Activity A to B.
Hi we know that life cycle methods of a activity are onCreate() - onStart() - onResume() - onPause() - onStop() - onDestroy().
but what will be the transition of these life cycle methods when going from Activity A to B, below is the example to...
How hashMap internally works in java ?
It’s not wrong to say that HashMap is an implementation of Map interface as it allows value storing in key value pairs. Although unique elements are present in Hashmap, null values and only one null key are allowed.
Hashmap basically wor...
Introduction to Collapsing Toolbar
In this Android Video Tutorial, you will learn about how we create a Collapsing toolbar by learning few XML tags.
XML tags covered in this tutorial are: CoordinatorLayout, AppBarLayout, CollapsingToolbarLayout and NestedScrollView. You can a...
Android Intents Video Tutorial
In this tutorial, you will learn the Intents and its usage in Android
Intents are the Activity-launcher and also act as a message carrier.
Intents is very much helpful in performing various functions that make use of other application like came...
How to refresh your list when you swipe down at the top / use of SwipeRefreshLayout
Sometime we need to refresh our list when we swipe down at top of our list so this feature is attained with the help of Swipe Refresh Layout. Here I am showing the list with the help of recyclerView, so we need to add SwipeRefreshLayout tag in ou...
How to make use of RecyclerView to show the chats between two people in your app?
If your app wants to show the chats between you n your friend then you can make use of RecyclerView.
Here in the layout that is being inflated in RecylerView, I have used the visibility concept that the layout consists of two major layouts one...
How to use WebView in Android?
This tutorial describes how to integrate WebView in Android. A Webview is the UI element which is use to load webpage inside the application.
For any queries feel free to post comment.
How to set your camera to a particular location in yor google map in android app?
If you wish to show a particular location on google map in your android app, this can be done by using the following code in the activity where you have implemented the map :-
public class LTJMapActivity extends FragmentActivity implements O...
How to inflate two layouts in a single RecyclerView?
Sometimes we need to show the list with different views so for this we can inflate two layouts in RecyclerView. To know how it is achieved follow the steps mentioned below:-
Create two layouts xml files I have named them "program...
How to initiate Skype call through your android app
To initiate a skype call through your android app please add the code mentioned below :-
The third line
Uri skypeUri = Uri.parse("skype:" + number + "?call");
in the code below helps you to make call but if you need vi...
Sending parameters using GET request RETROFIT
Sending the parameters in GET request is quite different you can't append dynamic query to the URL .
Another way of using it.
http://testserver.com/api/login?api=login&value=test
Using retrofit as follows:
Map<String...
Create a Radar view in android
Hello All,
Looking to create a view like radar in android.
Step 1:- Find the java file along this blog and add it to your project.
Step 2: In your xml use this class to create view.
<com.example.RadarView
android:id="@+i...
How to create Contextual action mode over toolbar using recycler view in android?
While creating list on a recycler view we need more functionality like delete, copy and more. Like our popular apps what's app, gmail and hike we found toolbar in action mode if we long press list items on that, same UI with functionality we ...
How to open hyperlink text in webview/browser in a android app
Suppose in out text/paragraph of textview, some words are clickable or hyperlinked. In case you have a task to open those hyperlinked text in a webview of any browser you have to use SpannableStringBuilder. Below code with details will help you t...
justify text in android using webview
Android does not support justification of text,but we can achieve this using loading the text in WebView.
String youtContentStr = String.valueOf(Html
.fromHtml("<![CDATA[<body style=\"text-align:justify;color:#222222; \">"
...
Android Pie chart example using MpAndroidChart Library
Step1: Adding MpAndroidChart android library into project
dependencies {
compile 'com.github.PhilJay:MPAndroidChart:v2.1.6'
}
repositories {
maven { url "https://jitpack.io" }
}
Step2: Pie Chart layout in your xml...
Debugging local databases and Preferences.
When you need to debug database and shared prefrences in an android application, it is difficult to debug it.
Android Debug makes it easy to debug the databases
Add this to app’s build.gradle- debugCompi...
How to update/refresh device gallery after adding new images
In some of the devices while uploading/adding new image into media are not shown to the custom gallery view. However this does not seem to update until the device reboots. To update your custom gallery with new images, below few lines of code wil...
Save image taken from device memory to a specific folder in Android
Step1: Permssion needed to save image.
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Step2: Saving image to the particular directory with new name as given by the user. This will make a seperate direct...
How to seamlessly enable location/gps without redirected to the location service window
Most of the apps requires the user to manually enable the gps setting which causes confusion with the user as they are redirected to the location services window outside the app. The below code will help you to seamlessly enable location/gps with...
Using handlers in android.
Brief Introduction
In Android apps there are scenario where we need to communicate the thread with our UI .Like downloading image from server and communicating to UI thread that downloading is completed or it is interrupted.
Hand...
Location Setting API Android
This blog is about how to show Popup for enable Location setting.
1. Add below dependency to app gradle file.
compile 'com.google.android.gms:play-services:9.6.1'
2. Implement GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConn...
How to avoid adding emoticons in android edittext
If you don't want to allow users to add emoji in edittext then below few lines will be helpfull for you. This method will return blank string while typing any similies/emoji in your editext.
public static InputFilter EMOJI_FILTER = new I...
How to play Youtube video in your android app
In previous posts we discussed about how to generate youtube video thumb and video_id. Now we are going to implement how to play videos in your android app by going through below easy steps.
Step1: First adding YouTubeAndroidPlayerApi li...
How to generate video id from youtube video url in android
If you are using YouTubePlayer in your android app and wants to play youtube video on that, so first we need a youtube video url. From that url we can get a video id(11 alphanumeric character set). In below example we are going to generate a vide...
How to add CirclePageIndicator with ViewPager in android
CircularPagerIndicator is usually a kind of indicator that used to know how many images or tabs are left in our view. It is like a dot at the bottom of a view, more you can get by implementing below few lines in your project.
Step1: permission...
How to create youtube video thumbnail in android
In order to create youtube video thumbnail in android we have to first initialize its view i.e. YouTubeThumbnailView in our xml file. On initializing YoutubeThumbnailView we have to add developer key and its InitializationSuccess listener with tw...
Implement FCM from Android Studio GUI
This blog is about how to implement FCM(Firebase Cloud messaging) from Android Studio.
Android studio gives you tools to implement Firebase tools in very easy way.
1. Open Android Studio. (Make sure Android Studio is up to date)
2....
How to create verticle bargraph in android
Step1: Add dependency MPAndroidChart and jitpack maven repository in your build.gradle
repositories {
maven {
url "https://jitpack.io"
}
}
dependencies{
compile 'com.github.PhilJay:MPAndroidChart:v2.1.6'
}
S...
What's new in latest Android studio version 2.2?
New studio version 2.2 has many features that provide developers vast range of functionality.
1. Layout Editor
Drag and drop from widget palette ,new blue print of your layout,tools like auto correction.
Properties panel ...
Parcelable Android Example
Parcelable is mechanism for passing data between Activities. Parcelable works same like serialization but It is faster then serialization.
Here are the points to make class parcelable.
1. Create simple model class like below I created with ...
Parse Json Object with dynamic keys using Gson
Gson is a java library which converts Json to Java object and vice versa.
This blog is about how we can parse Json data to Java Object where keys are dynamic created.
1. Json Sample text is:-
{
"data": {
"status_code": "101",
"...
Auto-Reply to Texts Messages on Android device When Youre Busy
In certain cases, we are busy with some work and we don't have free time to reply our device incoming text messages. In that case, you will send an auto-reply message to all the incoming messages about your situation which goes something like...
Monkey Testing with ADB command.
This blog is about how to use MonkeyRunner tool with ADB.
MonkeyRunner Tool to test app UI and functionality. pseudo-random streams of user events and system events is generated by MonkeyRunner. MonkeyRunner controls the workstation by sending...
How to retrieve contacts from your android device
Step1: permission needed to read contacts
<uses-permission android:name="android.permission.READ_CONTACTS"/>
Step2: ContentResolver provides access to the content provider. Its main work is to read the user's query and redirecti...
How to get Image from URL using glide library
The below example code will helps you to get Image from URL by using glide library and to wait for image until it loaded. For this in below example I have added glide library in build.gradle file then I am using Glide with MainActivit...
How to implement ViewPager with tabs in android?
To switch easily from one page to another using slide either from left-to-right or right-to-left becomes easy using ViewPager. The below example is to make view pager with TabLayout, tabs may be used to display headings, we can also move easily f...
How to get GCM registration token in Android
GCM(Google Cloud Messaging) registration token is a kind of id given by the GCM connection server to user/client that allow user to receive messages. To get registration token first we have to generate a unique number, it can be created while con...
How to Mute/Unmute device sound programmatically in android?
In some of the cases in our application, we have to set our devices in Mute/Unmute mode. To get this functionality we have to add few lines of code. I have added two buttons one is for Mute and another one is for Unmute our device described below...
How to catch activities in foreground/background using ActivityLifecycleCallbacks?
To catch the states of every activity in our android application we have to implement ActivityLifecycleCallbacks. ActivityLifecycleCallbacks will have different override method as onActivityCreated, onActivityStarted, onActivityResumed, onActivit...
How to authenticate with Fingerprint in android applications ?
From android marshmallow api 23 android supports fingerprint authentication support. Fingerprint api support android version 6.0 or greater.
Fingerprint authentication contains following process :
1. Check weather a user enabled keyguard or...
Linkify text in Android Textview
Linkify is very helpful to create links from TextView or Spannable. Linkify get Regular expression and work on Text with Regular expression.
For example, you have a random text which includes web URLs also and you want to use web URL a...
Behaviour of launchMode "singleTop" in Activity (manifest)
How launchmode parameter in activity behaves
<activity android:name=.FirstActivity
android:launchMode=singleTop></activity>
Let us assume different activity as A ,B ,C ,D ,E
1 and...
How to use Butterknife in Android?
ButterKnife is library to initialize the views with Annotations.
With the help of Butterknife you have no need to initialize view with findViewBtId().
here we start.
1. Create Project.
2. Open module level build.gradle file.
3. Add b...
How to declare dimension of activity and how to start launch bounds activity ?
Hi, Android 7 i.e nougat supports multi window mode to open more than one screens at a time
With help of this flag one activity can be open adjacent to another activity.
Require jdk : 1.8 or higher
Require sdk : 24 nougat
Require depe...
Android 7 to create resizable and minimum size activity
Hi, Android 7 i.e nougat supports multi window mode that means at the same time two or more screens can be open like to open email on right side and gallery on left side.
So to create multi-window screen we have to use a flag in manifest named...
Features of Android Nougat api 7
Now Android API version 7 is ready to launch in the market with name Nougat.
Nougat has some features that are listed below :
Performance - For Fast updates now just in time compiler comes with new updates, VR mode etc.
Battery...