Skip to main content

Posts

Showing posts from 2012

Android Background processing with AsyncTask

I had to download data from server and bind it with the ListView .I studied about this and finally used AsyncTask for background processing.I'm going to post some code and it's description about Android background processing. AsyncTask AsyncTask is designed to perform background processing and publish result on the UI thread.It is a helper class around Thread and Handler and does not constitute a generic threading framework.AsyncTask is defined by three generic types called Params , Progress and Result .And it has four callback methods called onPreExecute() , onPostExecute() , doInBackground() and onProgressUpdate() . public Load extends AsyncTask<Params,Progress,Result> { } AsyncTask's generic types Params :-It's a parameters send to the task upon execution. Progress :-This parameter shows progress units during background processing. Result :-It return type of result of the background processing. If you don't require it&

Get device name,IMEI no,screen width,height and mobile no in Android

Hi friends,Today I'm going post about how to Get device name,IMEI no,screen width,height and mobile no.Few days ago I need to use this all in my recent project but could not seen any tutorial which explains about this all.So have look on code part it's pretty easy.Android provides us API for this all. Code: public class Utility {     int sh, sw;     Context context;     DisplayMetrics metrics;     public AdParameters(Context context) {         // TODO Auto-generated constructor stub         this.context = context;         metrics = context.getResources().getDisplayMetrics();     }     public String getDeviceName() {         return android.os.Build.MODEL;     }     public String getIMEI() {         // TODO Auto-generated method stub         TelephonyManager telephonyManager = (TelephonyManager) context                 .getSystemService(Context.TELEPHONY_SERVICE);         return telephonyManager.getDeviceId();         // return (

Create Database in Android using SQLite

Hi all ,Its my great pleasure to write an article about Database in Android.We consider you have some knowledge of Android application development,Java like Singleton class and Database also.So first have a look on XML part : Menu.xml <?xml version= "1.0" encoding= "utf-8" ?> <LinearLayout xmlns:android= "http://schemas.android.com/apk/res/android"     android:layout_width= "match_parent"     android:layout_height= "match_parent"     android:orientation= "vertical" >     <LinearLayout         android:layout_width= "fill_parent"         android:layout_height= "wrap_content"         android:orientation= "horizontal"         android:weightSum= "100" >         <Button             android:layout_width= "wrap_content"             android:layout_height= "wrap_content"             android:layout_we