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
Gradient Drawable in Android
To make Button,TextView,Images and other android components looks better and stylish, we create Gradient drawable.
For using Gradient drawable, we can make shading effects and make better GUI.
We need to create drawable folder inside the re...
There is an Application to Receive the Intent or not in Android
Hi friends,
For Implicit intent, we dont need to declare the name of the class but we declare the action that we are doing to perform.
Like here we make a call
Uri callUri = Uri.parse("tel:100");
Intent intent = new Intent(Intent.AC...
How to Set WallPaper in Android
Hello Friends,
Here I am writing code to set wallpaper in android.
Its very applicable in many scenarios like after downloading an image we have to give an option to set it
as wallpaper or make functionality to create App wallpaper to pho...
Disable back button in Android
Hi Friends...
Sometimes we need to disable back button in our application mostly for security purpose.
So here is the solution. We just need to implement onBackPressed() method but returns nothing .And if you want to do some other task on ba...
Get Country name without using location
Hi...
Usually we get country name by using our location via GPS settings. But somehow on situations we need to get country name without using GPS.
For these situation, Android provides Locale to get our device's country name.
We are us...
How to get IMEI number,serial number and software version of your phone
Hello...
Sometimes we need to know the country code, IMEI number, subscriber of a phone.
Their is very simple solution, For this android gives facility to know it by providing TelephonyManager class.
TelephonyManager have many methods t...
Difference between AutoCompleteTextView and MultiAutoCompleteTextView
In most of the applications user wants suggestions from a ListView/Source while typing in an editable text field. For that particular thing we have two different editable TextViews which provide a drop down menu.
AutoCompleteTextView only o...
Logging in android
A very nice system is use for logging in android, usually called a centralized system.
Developer can filter log statements by using android tools.
We can create log statements by using android.util.Log class. Log class have so many methods l...
Generate SHA1 Key in android
In android we need to generate SHA1 key fingerprint to get Google Api key for Google Map.
It just a one line command to generate SHA1 key.
First of all create your .keystore file and sign to your app and take down this keystore lo...
Check Network Availability on android
We know that Its not possible that our android device should be always connected with a network.
It might be a situation when we would not connected with any network, So to check it whether we are connected with any network or not.
We check...
How to make listview scrollable inside ScrollView
If you apply ListView inside ScrollView, then the items of ListView will not scroll. By default the scrolling of ListView will not work if defined inside ScrollView. To make the scrolling work, use the onTouchListener. Below is the code to make l...
Capture Image using device camera
This video tutorial describes how to capture an image using device camera.To captured an Image using device camera use to following code:-
private static int REQ_CAMERA = 1001;
Intent takePictureIntent = new Intent(MediaStore.ACTION_...
How to send a status message to my server when android activity get closed ?
Sometime we wish to track our user activity when user closed particular activity in app so we can follow this life cycle of Activity :
If you want to send status to your server when application closed or force quit then you should use override...
How to correctly use the AlarmManager class to execute a task at fixed intervals?
This Post ll help you to manage your alarm :
AlarmManager am=(AlarmManager)getSystemService(ALARM_SERVICE);
Intent alarmintent1=new Intent(MainActivity.this, AlarmReceiver.class);
PendingIntent sender1=PendingIntent.getBroadcast(SpeedMotor...
Dp to Px converter and vice-versa
As we all know that Android works with dp size.
But what to do if we have px values and want to check corresponding dp value ?. Don't worry try this -
public static int pxToDp(int px, Context ctx) {
DisplayMetrics displayMetrics = ctx.getRes...
Custom Toast in Android
Android give facility to change the view of a Toast. Sometimes we need to show message on a better way to user .
Here I am writing code to implement custom Toast. I make a separate layout for Toast .
Here I am showing a ImageView and TextVie...
How to implement a ListView in your Android application ?
This video tutorial describes how to implement ListView
A ListView is a view group that displays items in a scrollable list. By the help of adapter, list items are automatically inserted into the list. We just need to set the adapter using setAd...
Scan Wifi networks in your App
Android give facility to access the Wifi Network in your Application. You can access nearly every information of the connection.
Android have WifiManager API to handle all Wifi Connectivity.You can use it like this:
WifiManager wifiManagerO...
Run Multiple AsyncTask on a Single Time
In android, thread pool pattern is use in AsyncTask.
Early the size of the pool was 1 i.e,
there was no support for parallel bunching of AsyncTasks.But from HONEYCOMB version Android allows multiple Asynctask at a time.
We just have to use...
How to send sms using Intent ?
This video tutorial tells you about how to send SMS using android intent.
For sending an SMS using Implicit Intent, call the intent like this:-
// call Intent to send sms
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.fromParts("sms", "9...
How to install android apk file on Emulator in Linux
To install apk file on Emulator Follow the below mentioned steps:
1.Go to platform-tools in android-sdk and Copy the apk file in it.
2.From your Terminal navigate to platform-tools folder in android-sdk.
3.Then use this command
./adb ...
How to add new Columns to table without loosing data of the older version
I am writing this blog to add columns in our database table which would compatible with old version of database.
Here I use Alter Table command on my onUpgrade() method where I make condition for the database version.
We can add only one column...
Inserting data in android SQLITE table
Hi again,
Here we are going to learn how to insert data in the already created table in android SQLITE. You will find it useful if you are aware of the basic terminology of the android SQLITE, if not and you want to create a table so it will be...
Creating a table in android SQLITE
There are situation when we need to maintain(store) data at our application level, this is mainly done when we try to execute functionalists at offline mode. So for these kind scenarios android sdk has provide us class known as SQLiteOpenHelper w...
How to create zip file in android
Here I am writing code to create zip file in android application.
Here, First I create directory where I create zip file.
Then by using Compress class I create zip file having some valid images already saved on our device.
private File cre...
How to make a call from your android application
This tutorial describe you how to make a call from your android application.
To make a call you just need to call Implicit intent like this:-
// call implicit intent with phone number to make a call
Intent callIntent = new Intent(Intent.ACTI...
How to send email using Intent in android
This tutorial is about sending the Email from your android code using implicit intents.
Following is the code to send an Email-
Intent emailIntent = new Intent(Intent.ACTION_SENDTO
, Uri.fromParts("mail...
Search location by using place on google map
Here below is the code for searching places by using place name.
I use api provides by google also know as google place api.
"http://maps.googleapis.com/maps/api/geocode/json?address="+CITY_NAME+"&sensor=true";
In response of it We g...
How to know free space in sdcard android
I have written code to know free space in sdcard
Here I use StatFs class to do this.
I just multiple available blocks which I got from getAvailableBlocks() and block size from getBlockSize().
StatFs st = new StatFs(Environment.getExter...
Save files from a sdcard folder to another place
Here below I have written code for copy file from sdcard and paste it to another place.
I do this by using InputStream and OutputStream classes.
Your target file should exist before doing this task.
// your sdcard
String sdCardStr...
How to implement a WebView in Android Application
WebView is a special control that has a capability to display a webpage inside your application.
Watch this Video tutorial to know how to implement WebvView inside your Activity.
Android Powerful and optimized Image loader - Glide
Hi,
Are you still working with Image Loader or Universal Loader library for lazy loading of images in listview. if yes then you should know that sometimes these libraries could give out of memory exception if you are fetching lots of images o...
Image splitting in Android
Image split can be required by different android puzzle application where there is a need to divide the one complete picture into different pieces.
Here is the function that takes three argument one is the imageview that holds your complet...
Load Html file from assets folder to WebView in android
Load Html file from assets folder to WebView
Here I write code to load html file from our local folder assets to our WebView.
First we get String Url from file and then load it to webview.
private WebView webTerms;
webTerms = (WebView)fin...
Blink Animation in android
Blink Animation in android
Here I write code for blinking any components like TextView, ImageView etc.
Here I just use AlphaAnimation class of Animation .
TextView textMessageCenter;
textMessageCenter = (TextView)rootView.findViewById(R...
Audio Capture In android
Audio Capture In android
To record audio there are so many ways. But Here I write audio recording method using MediaRecorder class.
To use MediaRecorder class ,we must create an instance of MediaRecorder class.
Syntax :
MediaRecord...
Image Blurring Effect Android
Image Blurring Effect Android
Here I share my image blurring code. We have to pass the bitmap of the ImageView that we have to blur out and radius should be in integer value 2,4,8....
It returns the Bitmap of blurred image.
Now a days w...
How to open a Url using Intent
To open a url using Intent, first create a button on the layout. And set the onClickListener on the button and open the browser using implicit Intent, like below:-
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivit...
Application is in Forefround or background
Application is in Forefround or background.
Here I write the code to know whether our application is in background or forground.
We use Application.ActivityLifecycleCallbacks interface and know status in onActivityResumed() and onActivityPaus...
App is in running state or not
App is in running state or not:
We can know the status (Running or not) of our application by using ActivityManager class and attribute ACTIVITY_SERVICE.
We just check our process name to compare with package name of the project.
Activit...
Activity Context and Application Context in Android
Below are the differences between Application context and Activity context
Application context and Activity context are the instances of Context but both of them are tied to different life cycles. Instance of Application context is tied to App...
How to create a transparent Activity in Android
You have to add a theme attribute in the Android manifest file under activity section. So that only that particular activity will become transparent.
After the above step, add background attribute to your layout file as shown below:
&l...
How to navigate between activities
This tutorial describes how to navigate between activities.
For navigating between activities we use Explicit Intent.
For this we create a new Intent, specifying the current Activity's context and the class of the Activity to launch. And pass...
Playing sounds in Android
Playing sounds in Android
Copy your sounds in raw/ folder in res/ . If you do not have raw/ folder then make one by right clicking on
res/ folder, click on Android resource directory and then giving directory name as raw and selecting resou...
How to give look and feel to TextView like EditText
In many applications we have to create form that contains both EditText and TextView. The look and feel of EditText and TextView are completely different. So for making the TextView appearance similar to EdiText we have to specified its style att...
Android: Disable space and special characters in Edittext
Many times we have faced problems like we want to disable special and space character in edit text.
So to prevent this we have a property called "android:digits", we have to list the characters which we want to allow in edit text.
...
Zoom Animation in android
Zooming Animation in android
Here I am writing a code for zoom animation.
Here I have add this animation on mic button. You can add it according to your requirements.
First of all implements Animation.AnimationListener listener.
Then in you...
Static Map in android
Static Map in android
Here I am writing a way to show static map on ImageView.
Its image of map that displays on mobile without the help of any api key.
Here we just make String url to add your latitute and longitute.
like
private d...
Play Device's default Notification sound
You can play android device's default notification sound using RingtoneManager:
Get the path url of the notification sound from the getDefaultUri() method.
Pass this url to getRingtone() method which will return the Ringtone Object
Play tha...
Vibrate and Sound defaults on notification in android
Vibrate and Sound defaults on notification in android
We need to add sound and vibration when notification comes in.
Here I have written the way to get default sound when notification comes in. And vibration because of notification.
...