i am unable to create second table in android

by ram » Tue, 09 Feb 2010 01:42:52 GMT

Sponsored Links
 this is helper class .
i m unable create a second table in my sqlite
please observe the following code

helper class.java

public class DBAdapter {

    private static final String DATABASE_NAME="satya_db";
    private static final int DATABASE_VERSION=1;
    private static Context context;
    private SQLiteDatabase db=null;

    private static String CREATE_TABLE="create table states(_id
integer primary key autoincrement,sna varchar(13) not null)";
    private static String CREATE_TABLE_P="create table places(_id
integer primary key autoincrement,pna varchar(13) not null)";
    public DBAdapter(Context ctx)


    private static class DatabaseHelper extends SQLiteOpenHelper {

        DatabaseHelper(Context ctx) {
        super(ctx, DATABASE_NAME, null, DATABASE_VERSION);


        public void onCreate(SQLiteDatabase db) {
         db.execSQL(CREATE_TABLE );

        public void onUpgrade(SQLiteDatabase db, int oldVersion, int
newVersion) {
            // TODO Auto-generated method stub


        public DBAdapter open()
            DatabaseHelper dbhelper=new DatabaseHelper(context);
            return this;

        public void close()

        public long insertRow(String sna)
            ContentValues cv=new ContentValues();
            cv.put("sna", sna);

            return db.insert("states",null,cv);
        public long insertRowP(String pna)
            ContentValues cv=new ContentValues();
            cv.put("pna", pna);

            return db.insert("places",null,cv);
        public int updateRow(ContentValues cvs,String p[])
            return db.update("states", cvs,"_id=?",p);

        public Cursor equery()
            return db.rawQuery("select * from states where
main class java

package touchmeme.Datalist;

import android.app.Activity;
import android.os.Bundle;

public class Datalist extends Activity {
    /** Called when the activity is first created. */
    public void onCreate(Bundle savedInstanceState) {
                DBAdapter db= new DBAdapter();



Other Threads

1. Plans for Change (Was: Petition: Google, please improve the Android Market.)


Whilst Apple may not be the fastest to respond, they did start out with a more 
developer-friendly store (e.g. no 325 character limit).

At the moment there is little the other stores can do to help Google because 
Google aren't helping us and don't seem willing to let us help them. We've 
offered them improved methods for piracy control, and tried to get access to 
their copy-protection measures so there is one standard for copy-protection, 
but they didn't want to discuss the priacy control mechanism so we're left on 
our own.


P.S. Just wondering; Where did you get the title "Android Expert" from? Did you 
go through some sort of certification process?


* Looking for Android Apps? - Try http://andappstore.com/ *

Funky Android Limited is registered in England & Wales with the company number  

The views expressed in this email are those of the author and not necessarily 
those of Funky Android Limited, it's associates, or it's subsidiaries.

On 1 Mar 2010, at 03:42, Fred Grott(Android Expert, 


2. Apk yang bagus untuk nambah homescree

as subject, setelah tahan2in pakai 3 homescreen di miles...
makin terasa kurang leluasa.

kemarin sempat coba OpenHome, tapi kok kurang puas yah... kadang2
muncul msg Force Close...

ada kah suhu2 yang bisa kasih saran harus pakai apa?


The teacher who is indeed wise does not bid you to enter the house of
his wisdom but rather leads you to the threshold of your mind. -Kahlil

"Indonesian Android Community [id-android]" 

3. Software android yg harus dibuat

4. Instal apps2SD

5. Opening SQLite database fails for reasons unknown

6. Launching Instrumentation examples from ApiDemos

7. oot: lucu2an siang hari