Pages Navigation Menu

Coding is much easier than you think

How to find version of sql light database used in android

Posted by on Apr 15, 2013 in Android | 0 comments

Below is android API version for corresponding SQL Light Version

SQLite 3.7.11:

  • 17-4.2-Jelly Bean
  • 16-4.1-Jelly Bean

SQLite 3.7.4:

  • 15-4.0.3-Ice Cream Sandwich
  • 14-4.0-Ice Cream Sandwich
  • 13-3.2-Honeycomb
  • 12-3.1-Honeycomb
  • 11-3.0-Honeycomb

SQLite 3.6.22:

  • 10-2.3.3-Gingerbread
  • 9-2.3.1-Gingerbread
  • 8-2.2-Froyo

SQLite 3.5.9:

  • 7-2.1-Eclair
  • 4-1.6-Donut
  • 3-1.5-Cupcake

There are also several other SQLite versions out there (list by no means exhaustive):
** UPDATE: Android Complete tutorial now available here.

  • LG Optimus Sol E730/myTouch E739/myTouch Q C800 (10-2.3.3-Gingerbread, GRJ22)
  • LG Optimus Vu F100S (10-2.3.3-Gingerbread, RK39F)
  • LG Optimus LTE TAG F120K/F120L (10-2.3.3-Gingerbread, GRK39F)
  • LG Optimus LTE L-01D (10-2.3.3-Gingerbread, GRJ90)
  • LG Optimus Net P690b (10-2.3.3-Gingerbread, GINGERBREAD)
  • LG Prada KU5400 (10-2.3.3-Gingerbread, GWK74)
  • LG Prada P940 (10-2.3.3-Gingerbread, GWK74)
  • LG LU6200/SU640 (10-2.3.3-Gingerbread, GRJ90)


  • LG Esteem MS910 (10-2.3.3-Gingerbread, GSE-_v.05)
  • AndroTab (8-2.2-Froyo, 1.0.7100.0385)
  • GPLUS MUSN M500 (8-2.2-Froyo, FRG83G)


  • Motorola Backflip MB300 (7-2.1-Eclair, ERD79)
  • Garmin-Asus n¼vifone A10/A50/Garminfone (7-2.1-Eclair, ERE27)

Android SDK level links show where the android.database.sqlite package has changed. Where there is no link (e.g. SDK level 17), indicates no changes to that package.adb command to get SQLite version only works on emulators and on devices with sqlite3 available:

Programatically finding SQL database Version:

Cursor cursor = SQLiteDatabase.openOrCreateDatabase(":memory:", null).rawQuery("select sqlite_version() AS sqlite_version", null);
String sqliteVersion = "";
   sqliteVersion += cursor.getString(0);


Read More

decompiling DEX into Java sourcecode

Posted by on Apr 15, 2013 in Android | 0 comments

Step 1:

Make a new folder and put .apk file in it (which you want to decode). Now rename the extension of this .apk file to .zip (eg.: rename from filename.apk to and save it. Now you get classes.dex files, etc. At this stage you are able to see drawable but not xml and java files, so continue.
Step 2:

Now extract this zip apk file in the same folder (or NEW FOLDER). Now download dex2jar from this link and extract it to the same folder (or NEW FOLDER). Now open command prompt and change directory to that folder (or NEW FOLDER). Then write dex2jar classes.dex and press enter. Now you get classes.dex.dex2jar file in the same folder. Then download java decompiler from and now double click on jd-gui and click on open file. Then open classes.dex.dex2jar file from that folder. Now you get class files and save all these class files (click on file then click save all sources€ in jd-gui) by src name.

Read More

Failed to install *.apk on device *: timeout :- Android Error

Posted by on Apr 15, 2013 in Android | 0 comments

Just we need to extend the time , to remove this error.Try changing the ADB connection timeout. I think it defaults that to 5000ms and I changed mine to 10000ms to get rid of that problem. If you are in Eclipse, you can do this by going through Window -> Preferences and then it is in DDMS under Android.
** UPDATE: Android Complete tutorial now available here.
We can restart the adb to remove this error .

  • adb kill-server
  • adb start-server

With some never versions of the Platform Tools you can do this from the DDMS Perspective in the Devices Tab menu (near the Capture Button), click on Reset adb.

It is preferable to use the USB port in the back of your PC, since most of the front USB ports are low powered, and really seem to be slower when uploading apks on your devices.

  1. Clean and rebuild your project completely. If you are using Eclipse:
  2. Click the Project menu at the top, go to Clean
  3. Select your project, then click OK

I’m sure you have done this, but also try restarting your IDE.

This may sound stupid, but make sure your AVD IS running (and not locked up).

Changing the USB is also one of possible solution .

Read More

How to get screen density in android programmatically

Posted by on Apr 15, 2013 in Android | 0 comments

We can get screen density from component called DisplayMetrics as below .

DisplayMetrics metrics = getResources().getDisplayMetrics();

Though Android doesn’t use a direct pixel mapping, it uses a handful of quantized Density Independent Pixel values then scales that to the actual screen size. So the density property will be one of those constants (120, 160, or 240 dpi).
** UPDATE: Android Complete tutorial now available here.
If you need the actual density (perhaps for an OpenGL app) you can get it from the xdpi and ydpi properties for horizontal and vertical density respectively.

densityDpi parameter in DisplayMetrics gives you directly density region the phone belongs.

DisplayMetrics metrics = new DisplayMetrics();
     case DisplayMetrics.DENSITY_LOW:
     case DisplayMetrics.DENSITY_MEDIUM:
     case DisplayMetrics.DENSITY_HIGH:


The below code also gives you the density in different region.

0.75 – ldpi

1.0 – mdpi

1.5 – hdpi

2.0 – xhdpi

3.0 – xxdpi


Below code gives you directly screen size category .

int screenSize = getResources().getConfiguration().screenLayout ;

switch(screenSize) {
    case Configuration.SCREENLAYOUT_SIZE_LARGE:
        Toast.makeText(this, "Large screen",Toast.LENGTH_LONG).show();
    case Configuration.SCREENLAYOUT_SIZE_NORMAL:
        Toast.makeText(this, "Normal screen",Toast.LENGTH_LONG).show();
    case Configuration.SCREENLAYOUT_SIZE_SMALL:
        Toast.makeText(this, "Small screen",Toast.LENGTH_LONG).show();
        Toast.makeText(this, "Screen size is neither large, normal or small" , Toast.LENGTH_LONG).show();

To get parameter in dpi .

DisplayMetrics dm = new DisplayMetrics();

int dpiClassification = dm.densityDpi;

// these will return the actual dpi horizontally and vertically
float xDpi = dm.xdpi;
float yDpi = dm.ydpi;
Read More

Trouble getting Android emulator to run in eclipse

Posted by on Apr 14, 2013 in Android | 0 comments



I’m trying to run the SDK Samples on the Emulator in Eclipse 3.5

Most of the time the AVD Manager hangs when I try to create a new AVD. When I manage to create an AVD and try to start the emulator I get this:

emulator: ERROR: no search paths found in this AVD’s configuration weird, the AVD’s config.ini file is malformed. Try re-creating it.

Solution 1:

You can set the environment variable ANDROID_SDK_HOME. For example:

ANDROID_SDK_HOME=D:\Development\android-sdk\. Add this variable to <eclipseFolder>\configuration\.settings\org.eclipse.ui.ide.prefs:


Stop the process adb.exe and (re)start Eclipse.

Solution 2:

If you have special character in your username do this:

~/.android/avd on OS X and Linux,

C:\Documents and Settings\user\.android\ on Windows XP, and

C:\Users\user\.android\avd on Windows Vista, 7.

There name.ini and name.avd folder

  • copy the folder for example: C:\
  • modifiy the path in the .ini to path=C:\name.avd



Read More

This android sdk requires adt version 21.1.0 or above error in eclipse

Posted by on Apr 14, 2013 in Android | 0 comments


This error occurred to me too. I tried to update my SDK version using my SDK manager previous day and when I tried to use my eclipse after the api got downloaded, it threw the error. €œThis android sdk requires adt version 21.1.0 or above error in eclipse. Please update your ADT to 21.1.0 for SDK 21.1.0€. If you try to run your project ignoring this error, you will get an error saying €œyour projects are found to have errors€. But it would have run perfectly before updating. Below is the preferences window showing error €œAndroid SDK requires ADT 21.1.0 or above. Please update ADT€. The solution for this problem is simple and is given below.

Preferences –> Android Window:


Projects in Project explorer:

project explorer



In such cases the simple thing search for the required ADT 21.1.0 in my case (Previous version – 21.0.0) and install the plug-in to your eclipse. To do so, follow the below steps,

  • Go to Help –>  Install software
  • Click on Add at the right top
  • Give your ADT plug-in name and the URL location for it in the add repository window.


  • You can download the ADT version you want as a zip file.
  • Then click on Archive in the add repository window and browse your zip file and give it. Mention your adt plug-in name as well.
  • Now click on OK. Window as shown below appears below.

install window

  • Select Developer plugins option and click on Next to calculate your dependencies.
  • Accept the agreement and click on finish to install plug-in successfully. Once this is over, eclipse will prompt to restart it.

software updates

  • Click on OK to restart.
  • Now your SDK preferences are retained as it was before without error. Now the projects are available without error.

preferences_3 SDK updated


Read More