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
Getting the signal strength of WI-FI in percentage in android devices.
If you need to display WI-FI signal strength in percentage than you just have put this method getWifiStrengthPercentage in your utility class and call it whenever you need the Signal information.
public static int getWifiStrengthPercentage(Co...
How to scroll listview inside a ScrollView in Android.
Hello Friends
Here I am going to share a very important code to make ListView scroll inside a ScrollView.
Most of the Android developers says: Its not a good approach to put a ListView inside a ScrollView because a ListView is already a sc...
Some keyboard shortcuts in Eclipse.
Eclipse provides lots of keyboard shortcuts which can save your lot of time.
Here is a list of shortcuts that you might want to try out: -
**Navigation Shortcuts**
*Shortcut Description*
Ctrl + Shift + R Open / Search for resour...
How to open PDF file stored in remote server in android.
If you want to display a PDF file in your android application which is located at the remote server then you have to follow the instructions given below.
Add this web-view in your xml file.
<WebView
android:id="@+id/webView"
an...
Android create custom edittext with clear button.
In android there is no default text clear button functionality in EditText so here is a simple example of implementing text clear button in edit-text, You just have to follow instruction given below to make it in your edit-text.
1)- First you...
Storing and retrieving String[ ] Array using SharedPreferences in Android.
I came across to the many questions asking about to store some kind data in Shared-preferences such as String[] array. Many of these questions are answered with "Use a database".
But here i will show you a perfect piece of code by which you ...
How to hide title bar and status bar in android
In many application we need to hide the title bar of Activity/Fragment Activity. For this we need to add following line in onCreate() method before calling setContentView()
requestWindowFeature(Window.FEATURE_NO_TITLE);
Example:-
publi...
How to display a single text view in different colors
It can be done simply by setting your text as below :-
textView.setText(Html.fromHtml(getString(R.string.starting_up_message)));
And in your in your string file define that test say like this
<string name="starting_up_message">&l...
Detecting the Wifi-Networks in android
From here you can easily detect the Wifi-Networks as well as there info surrounding your device. This can be achieved by using the "WifiManager" in a following way :-
package com.example.wifidetector;
import java.util.List;
import andro...
Convert a Drawable into Bitmap
Following method tells how to convert a drawable into bitmap
// method to convert a drawable into Bitmap
public static Bitmap drawableToBitmap (Drawable drawable) {
// check if drawable is the instance of BitmapDrawable
if (draw...
Set or Get phone wallpaper from your Application
To set or get the wallpaper of android phone from your application, we used WallpaperManager. This class provides access to the system wallpaper. By the help of this class you can get the current wallpaper of your phone inside your app and even c...
Implement Gesture listener on listview item
This blog gives a simple example to implement Gesture listener ( or horizontal swipe) on ListView item.
public class MainActivity extends Activity implements OnGestureListener{
private ListView listView;
private ArrayList LIST;
...
How to check if your device is connected to Internet
We need to check if device is connected to Internet on making every API call (or call to Remote server).
The function below returns true if device is connected to Internet.
//**This function tells whether the device having an Internet connec...
How to Add Selector to the Button in Android
Adding Button Selector
to add button selector to the button in the android xlm layout file, create a new xml file named button selector and use the following code :
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:andr...
How to get Rounded Corner bitmap ?
In many android applications, we need to set rounded corner image in ImageView. The bad part is that ImageView does not provide any property for this. So for this the following method will help you get rounded corner Bitmap:-
public static Bit...
Saving an image into SDcard in Android
Sometime we need to save images on SDcard that we click or get from server in many applications, and you can do it very easily by using the below code.
To save Images on SDcard on Android Device, write the following code:
ByteArrayOutputStr...
Sample application of diffrent types of Android Animations
In this sample application you will find different types of animations. For example :- Bounce, Fade In/out, Blink, Sequential Animation etc. If you want to use any animation in your app you just have to add that particular piece of code in your ...
Sample Barcode Scanner Application
Here is a sample code of simple **Barcode Scanner** app.
Barcode scanner library is attached with this project you just have send an startActivityForResult to open Scanner like this.
Intent intent = new Intent(getApplicationContext(),Captu...
Diffrent types of signUp pages in android
Signup tutorials for the beginners. In this tutorial you can see different types of signup pages in which date of birth is included , Signup using Facebook and other options as well for android. You can add this code in you application to get the...
Custom Login Activity
Two Login Samples
First Sign Up Sample for Username and Password .
Second Sign Up Sample for Email and Password.
Use the zip file and check the output .
Hope the code helps you
Thank you.
How to Create Animation in Android
How to create basic animations in android :
In this blog i will show you how to create simple shake animation in android.First create a anim folder in res/anim in the android project. Create a xml file in it sopy the following code in it
...
how to detect swipe left or right function on listview item in android
If you want to detect swipe gesture from left to right or right to left on the list view item in android.
than you just have to add this Class in your activity and perform any task by detecting any type of gesture
in your list item in android...
Remove all the previous activities from the back stack in android
Whenever you switch from one activity to another using intent and specially in the case of logout and sessions related android applications you will find activity back stack issue.
Here i will show you a small piece of code which will help you...
How to improve selection criteria of your app using Radio button?
Radio Button
A radio button is a two-states button that can be either checked or unchecked. They are normally used together in a RadioGroup. When several radio buttons live inside a radio group, checking one radio button unchecks all the others....
Android how to send SMS
For sending SMS in Android, we have two different ways to do so, First is by using Android's built in SMS application and other is by using Android's SMS manager Api.
Here is how we do that:
1: By using Android device's built-in SMS applica...
How to call a javascript function through android
If you are trying to load a web page inside android web view. Then a known java-script function of the page can be called through android in following way :-
webview.loadUrl ("javascript:methodName(\""+parameter1+"\",\""+parameter2+"\")");
...
Trick to apply Http connection timeout for post and get method in android?
While working with application that connects to a web service and sometime it wait too long if it can't get a connection. To avoid this too long waiting you can set connection timeout timing of the HTTP params as per you want.
If you want to d...
How to show Distribution Bar Graphs in Android
From here you can be able to display the Bar Graphs through android applications. First of all you need to add achartengine-1.0.0.jar to your project . Which can be easily downloaded from here
Now you can use the following activity, in which...
How to create a Custom Button
How to create Custom Button in Android
In Android it is very easy to use buttons , eclipse Ide provides you with drag and drop functionality.But we can use different approach and create our own custom button.
create an android projec...
How to open an URL in Android's web browser using intent
Here is how we can open an URL in Android's web browser.
Just pass the URL in Intent like:
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.evontech.com"));
startActivity(intent);
Also, do not forget to add the inte...
How to check if a device has camera in Android
At times, we make apps which use camera feature but that app can also be used on non camera devices for other features. There we have to apply a check on using the camera feature, that is as follows:
PackageManager packageManager = activity.ge...
How to use Permissions in Android
Android use Permissions
In android we have to set permissions in the project manifest file to get the required android resource. In a basic android application there are no permissions associated with it by default,so it cannot affect the...
How to add ImageView to the Layout
How to add imageview to the layout and change the source of the image with the click of the button.
This is a very simple android code in which we set the mage view in the layout and then use the the imageview to set the new source.This ...
Creating shapes,Boder,selector and Drawable using xml in Android
This blog will help you to Create shapes,Border,selector and Drawable using xml in Android.
1.Selector for a button: Create xml file named background_selector.xml in res/drawable and write the bellow code in that
<?xml version="1.0" enco...
How to create a simple Timer in Android
In this tutorial we will make a simple android timer application using a Handler.In the layout of the main activity we will set a TextView to Display the timer and to Buttons for Start and Pause. We set the string resource for the timer value...
How to make a Gridview with Horizontal scrolling
Here for the scrolling Grid View I have use SectionPagerAdapter . Simply what I have done here is that , i have created a Fragment with a layout containing a grid view. And with the help of SectonpagerAdapter the fragment will inflate as many as ...
Read Data From Raw Resource in Android
How to read raw data from raw resource in android. In this tutorial i am using a text file as a raw resource in res/raw/wordslist.txt .This text file is read by the activity and you can use the data whatever way you like.
for eg
You can...
Android Custom camera
This tutorial helps you how to create custom camera app, with the help of the following sample code.
The Custom camera capture the image with auto focus and flash on the click of the capture button.Some developers may require a camera u...
Getting roundedCorner for an Image in Android
Sometimes we need to display images with rounded corners in our several Applications, and this can be done very easily by writing some lines of code.
To get roundedCorner for an Image use the following code:
/**
* This method is used to ...
How to record an audio and save the audio file
In this tutorial, I'll be making a UI with a start/stop recording button. I am using MediaRecording class to record the audio.
After making the layout, Call the method below on click of the mike button in the respective class:
MediaRecorder...
Post in FaceBook using your Android device via feed dialog
In many applications we have to share content, links etc on Facebook. We can achieve this by using Facebook feed dialog. The following lines of code explains how to use feed/publish dialog.
First you need to get the app id and create a meta da...
Load Multiple Image From server using imageloader class store in cache memory in android
Displaying images in a mobile application is one of the most common tasks for app developers.
It can be quite challenging to efficiently load multiple images and display it on list-view or grid-view in Android.
You can use following single...
Steps to import and use appcompat v7 support library in your project
If you want to use the ActionBar APIs in the support library. So before you can add the action bar, you must have to set up your project with the appcompat v7 support library.
Steps given below to import and setup appcompat v7 support library...
Custom Dialog like spinner in android
If you want to create a dialog which will look like as spinner dialog of single choice in android which will open in button click event than you can create a custom dialog.
Sample code given below :-
You just have to call this method on cli...
TabHosting using TabActivity in android
TabHosting can be used to explore and switch between different views or functional aspects of your app.
In this tutorial we will make an activity and host three activities to its tab by using tab hosting . Tab layout is used for this purp...
How to create app icon on home screen on app installation in Android
Here is how we can create app shortcut icon on device's home screen after app installation:
There's only a few lines of code.
if(!MyUtility.getIsFirstTime(splash).equals("true"))
{
MyUtility.setIsFirstTime(splash, "tru...
Save ArrayList of Object into Shared Preferences in Android
Sometime we need to save ArrayList of Objects into Shared preferences so that we can use that data in multiple Activities when required. We can do that easily as below:
Suppose we have model Users as below:
public class Users
{
privat...
Impleneting a Navigation Drawer in Android
Navigation drawer
:It can used as an app's main navigation option on the left edge of the screen. it it hidden all the time and revealed on the click of the app icon or swipe gesture from the left of the screen. Navigation drawer is used...
Easy methods of incorporating Google maps for Android
First create a layout for Map Activity. The name of layout is activity_main.xml
<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
class="com.google...
Set Alarm Using TimePicker in Android
This tutorial will help you in creating an android application to set alarm using TimePicker. This is a basic android tutorial which will make you familiar with Intents , Pending Intents and BroadcastReceiver.
Step 1: Create an android ...