Monday, May 6, 2013

android how to add barcode scanner

creating bar code scanner in android application

i am assuming that you are using Eclipse for the development. Here is very simple way to add the barcode scanner to use in your own applications.
create new project and add these assets into your src folder. You can also download it from zxing. In your main activity add the below line of code where you want to scan something.
IntentIntegrator.initiateScan(this);

And, put the below function in the same activity

protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
switch(requestCode){
case IntentIntegrator.REQUEST_CODE: {
if (resultCode != RESULT_CANCELED){
IntentResult scanResult=IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
if(scanResult != null){
String upc=scanResult.getContents();

//put whatever you want to do with the code her
TextView tv=new TextView(this);
tv.setText(upc);
setContentView(tv);
}
}
break;
}
}
}

in this example it will just show the code in a text view after scanning is completed. This is just calling bar code scanner using the intent. This means if we already installed the bar code scanner in the device our application can contact with the installed bar code scanner. In order to integrate the complete bar code scanner in our own application we need to add the zxing library to our application.

Tuesday, April 9, 2013

List Of Android Versions And Code Names


Below are the List of Android versions and their corresponding code names.

Code Name Version API Level
No Code Name Android 1.0 API level 1
No Code Name Android 1.1 API level 2
Cup Cake Android 1.5 API level 3, NDK 1
Donut Android 1.6 API level 4, NDK 2
Eclair Android 2.0 API level 5
Eclair Android 2.0.1 API level 6
Eclair Android 2.1 API level 7, NDK 3
Froyo Android 2.2.X (2.2,2.2.1,2.2.2,2.2.3) API level 8, NDK 4
Ginger Bread Android 2.3-2.3.2 API level 9, NDK 5
Ginger Bread Android 2.3.3-2.3.7 API level 10
Honey Comb Android 3.0 API level 11
Honey Comb Android 3.1 API level 12, NDK 6
Honey Comb Android 3.2.X (3.2.1,3.2.2,3.2.4,3.2.6) API level 13
Ice Cream Sandwich Android 4.0.1-4.0.2 API level 14, NDK 7
Ice Cream Sandwich Android 4.0.3-4.0.4 API level 15
Jelly Bean Android 4.1


The all Android code names are eating item names and in alphabetical order. So the next code name may start with the letter "K".