Thursday, June 30, 2011

Listview cheats


Do you have a dymanically changing listView  then always use the tag("fill_parent")instead of  ("wrap_content") for its height for the list view.Android will redraw the listview whenever it find wrap content  on adapter.notifydatasetchange and if the list   is not  load use textview with the parameter below to fill the listview space


android:id="@android:id/empty"
android:layout_width="fill_parent"
android:layout_height="fill_parent"(ie only work when used with list with below parameter is used
android:id="@android:id/list"
android:layout_below="@id/header"
android:layout_width="fill_parent"
android:layout_height="fill_parent")

Monday, June 27, 2011

How to get past the internal storage error in android emulator


To get pass internal storage error

use this command

emulator -avd emulatorname -partition-size 150
this will increase memory of the internal storage of the emulator to 150 mb

Monday, August 9, 2010

How to create a Simple database in Android

To create a database
step1:
Intialize a SQLiteDatabase  variable ( SQLiteDatabase sample = null; )
step2:
Instantiate above variable Like sample  =  this.openOrCreateDatabase(DATABASE_NAME,MODE_PRIVATE,null);
step3:
This step is for to create a table in the database
sample.execSQL(CREATE TABLE IF NOT EXISTS TABLE_NAME ( FIRSTNAME VARCHAR , LASTNAME  VARCHAR));
These Three Steps Will Create a  database with a table

Friday, August 6, 2010

How to Install android apk File in the emulator

To install a apk file into the Android Emulator :

  • Install Android SDK  from the Site 
  • Extract the zip to D:\android-sdk-windows (or goto the directory u have extracted)
  • Next copy your apk file  to D:\android-sdk-windows\tools
  •  Goto Start -- Run ....& type cmd in that box.
  • In the Black Screen(Command Prompt) Type the Following
    • your installed driver for example D: ( press enter )
    •  cd  android-sdk-windows  ( press enter ) if  it's difficult to type the entire name use TAB
    •  cd tools ( press enter )
    • adb install your_application.apk
  • Next SEE YOUR APP ON THE EMULATOR
    • If not  or any other problem uses the following in the same Command prompt
        • $adb kill-server
        • $adb start-server   (restart the adb)