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
Android Studio Tips and Tricks: Keyboard Commands
Programming key commands
Action
Android Studio Key Command
Command look-up (autocomplete command name)
CTRL + SHIFT + A
Project quick fix
ALT + ENTER
Reformat code
CTRL + ...
How to use SharedPrefrence in Android
SharedPrefrence help us to store private primitive app data in form of key value pairs, but the data is lost when you uninstall the application or you clear application data through settings.To use the SharedPrefrence in your android app follow t...
Structure of Android Manifest file
In every android application AndroidManifest.xml is the necessary part. Manifest file contains every essential information about your appliucation. It contains information about your package, activities, permissions, services, brodcast receiver a...
How to load string array value from string.xml in android
Using below code I have created a load string array value from string.xml. String is a simple resource using the value provided in the name attribute. So we can combine string resources with other simple resourecs in the xml file. Below code will...
How to detect Android Softkeyboard
When user hits the BACK-Button on his android device, the keyboard disappears. How can I catch that event? In order to track softkeyboard is open or not, this tutorial is helpfull for you, and you will easily dissmiss the softkeyboard by pressing...
How to make pdf viewer function in android
Using the below code I have created pdf viewer function. Here I have created pdf Viewer Activity and used string download_token,publication_heading,download_info and pdf data fetch data in DatabaseHelper. I have also used DownloadManger fuction....
How to make Radial Gradient in android
Using below Layout code you can create a Radial Gradient, Here I have created a Gradient.xml layout by using shape and gradient property. By using GradientDrawer we can make smooth transition between two or three colors in liner, radial or sweep...
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...
How To Make Navigation Drawer in android.
Using below code you can create a android DrawerLayout, a FrameLayout and Linearlayout. The Linerlayout is divided in three linerlayout for using image and text. In this Navigation Drawer when I will click navigation menu the navigation menu w...
How to make Animate a Bitmap app
In the below example I have created Animate Bitmap program. By using animated bitmap function we will get the position and distance along a path. In below, code will animate image on screen. In my below code I have clearly describe how to make A...
How to implement custom GridView in Android with Images and Text
In this blog I am going to show how to make GridView or GridView function. In the below example I have created a adapter class , item class and Created another layout for GridView image. In values folder I have created color.xml file for color co...
Translucent navigation bar
Hello everyone,
I was working with navigation bar and found a way so that you could make the status as well as navigation bar transparent, your views could be shown bellow to the navigation bar, by default activity is shown above the navigatio...
Navigation Bar Height
Hello Everyone,
Want to get the height of on screen navigation bar ??
Here is a solution
private int getNavigation_bar_Height(){
Resources resources = getResources();
int resourceId = resources.getIdentifier("navigat...
Getting status bar height
Hello everyone ,
I was working on status bar and found that we could get the height of the navigation bar at runtime.
following is the code to get the height of the status bar.
private int getStatusBarHeight() {
int result = 0;
...
How to make Email validation function in android
Here I have created a Email validation function .By used this function we can check user input value like example (sachin@gmail.com)in this example validation function checked string value are proper format or not .In my below code I have clearly...
Is there any choice to kill the application unless there is a menu option in to kill it?
Quit Application by Menu Item
Hello readers,
While Goggling I found this question on stackoverflow, So I thought to share it here,
many users searches for "Dose user have any choice to kill the application unless we put a menu option in...
How to use Shared Perference in android?
Here I have created Shared Perference function. Shared PerFerence is used to display a screen with some text fields. Shared Perference saved value is used when we close application. The below code will clearly describe you how to use Shared Perfe...
How to make Text View with Rounded Corners in android?
In the below example I have created a Text View with Rounded Corners function. Here I have defined style to change background to textview. Below example will clearly describe how to make TextView with Rounded Corners.
Step(1)-MainActivity-
...
How to save activity instance state
Every android activity follow a life-cycle. There are certain situation when an activity goes into pause state or in stopped state but at some particular time your application need to keep valuable state (i.e. data)
This we can achieve by usi...
SpeechRecognizer.ERROR_NO_MATCH:
Hello guies,
As i was working on and speech recognition module i encountered a mysterious bug while the listener called for the second time to listen for voice input.
Bug detail :-
When you call the listener of the SpeechRecognizer ins...
CoordinatorLayout
Coordinator Layout
Coordinator Layout one of the finest example of the design and intelligence goolge has introduced yet .
This new layout is all about set of rules defined in Behaviors, we can define the views inside Coordinator Layout t...
How to make custom toast in android.
In the below example I have created a custom toast Function in Android, the toast will open in center of the screen. Here I have used a image, image shown below contains a toast at the bottom of the screen. For more see the below code, in which I...
Convert Bitmap to ParseFile in android
Hi,
I am writing my method that convert Bitmap to ParseFile that we need to upload image on parse.com server.
Below is the method in which we just pass our bitmap of image and we get ParseFile.
We use ByteArrayOutputStream then convert i...
How to share in whats app from Android application
Using Android Intent system we can share on whats app from our application. Whats App application have listeners that listen to intents to share media and texts.
Simply create an intent to share text, for example, and WhatsApp will be display...
load text file content from assest folder to textview
If you want to read some file from assest folder of your project then first you have to get assest folder file named read.txt.
InputStream class is used to read data or content from file, network or from memory, we can also use this input stre...
read phone call logs in android
Android provides Cursor interface to get all calls logs. A cursor interface provides read-write to get the result set by database query.
Here stringOrder query will access phone calls date wise in desc order.
Cursor loader basically perform q...
How to get device local ip address ?
Every android device has a local ip address and we can easily get that ip address for our backend purpose like we can save that ip address to our server.
In below method NetworkInterface is a interface that provides many methods to get device ...
How to make Advanced Adapter in Android.
If you want to create Item view function check below example. In the below example I have created a Advanced class. By using Advanced adpater many opretions can be consumed. In Advanced adapter we can easily use view holder method. Adapter call t...
Get Android device Model programatically
The following method can help you to find device manufacturer name and model name. To get these details Android provides Build class to get system properties like Build.MANUFACTURER returns the device build name.
Build.MODEL returns the model ...
Download a file programatically
In Android we can download a file from a given url so that we can use that file's data without downloading again and again so we save that file in internal or external storage of device.
you can use this method to download your file, you have ...
How to change the action overflow menu icon
To change the action overflow menu icon first you need to create a style for the overflow icon in which you need to set the new icon then use this style in your app theme.
Step 1
Create a style for your menu overflow icon in styles.xml and set...
How to get data from rss feed in android
RSS simply means Really Simple syndication, this is a xml document which is created by a website.
You need to parse this xml file and show the information:-
Here is the code that can help you :-
Step 1:-Declare the variable of which you wa...
How to make Draw on a Canvas in Android.
How to make Draw on a Canvas in Android.
If you want to create Draw on a Canvas function check below example. In the below example I have created a Suraface class. Canvas works like as an interface. I have also used onDraw() method for drawing e...
Login into webview without using http requests
We know that if we want to login into some form we have to create a asyncTask to do that and then in background some lines of https requests codes and then we check for response.
But by using webivew we can directly log in into our website wit...
unlock your android phone programatically
Do you want to unlock your device after some interval then you can do that by using following procedure -
You have to create a alarm manager that will trigger after sometime of interval and then you can use KayguardManager class of android tha...
Add contacts programatically in android
In android we can easily share data across the applications and this is done by using ContactProvider. A contact provider class is a flexible java class that provides you multiple row contacts to access person data.
we can also use contact pro...
Create a shortcut of your android application activity
Sometimes it is good to make a shortcut of your application activity so that we can access that activity directly. Assume that we have 10 activities in our application and all activity redirect one to another in order. And i want to see updates o...
Change image color programatically
If you want to change the color of an image then you can use the following code :
public Bitmap changeColor(Bitmap srcBitmap, int color) {
Bitmap resBitmap = Bitmap.createBitmap(srcBitmap, 0, 0,
srcBitmap.getWidth() - 1, srcBitm...
Change application language programatically
Now its possible to change the application specific language programatically It is working by setting locale. But you have to set it in all activities. Here is a code you can try these code.
you can get the local language using locale and can ...
Include Empty/Null Variable to Json while serialize with Gson Android
Are you using Gson for Serializing Json String from Java Bean/Model class? If yes then It may be useful for you.
Gson ignore null/empty value while serialize Object to Json String. Like
Gson gson = new Gson();
String jsonData = gson.to...
start one application from another
If you want to launch a application B from your application A then you can launch that by using intent Like this :
First define application B package name so that we can set launch intent :
Intent myIntent = getPackageManager().getLaunchIn...
kill android application all activities process
We know that on back press of button in any android application can finish the app or an activity but some process of application still works in background so if you want to kill all the processes of any application you can kill app process like ...
Run multiple async task simultaneously
Do you know that android version higher than gingerbread doesn't support multiple async task to run parellely but gingerbread ans lower version supports this functionality.
So if you want to run multiple task at a time you have to check api ve...
Stop asyncTask in background
We know that asyncTask class has four override methods and three methods runs in main ui thread but one method doInBackground runs in background thread. In case if we want to stop this background service based on same condition then we can use th...
stop GCM notification
sometime its necessary to stop or unregister notification services in your app like from your setting screen then you can use these codes.
you have to create a static handler in your gcm register class
static Handler myHandler;
and in...
get strength of wifi in your android device
If you want to get the strength of some wifi , you can use wifi manager class and can get list of available wifis like this
WifiManager manager;
manager = (WifiManager) getSystemService(WIFI_SERVICE);
List<ScanResult> res = m...
How to make set Wallpaper in Android device.
Here I have created Set Wallpaper in device method. In the below example I have created two activity and two layouts and added some function code in Android Manifest. Below example will described you how to set Wallpaper in device.
Step(1)-...