I am stretching the SQLiteOpenHelper class that helped me to connect and do my database work. Based on the documentation, the OnCreate method should simply be known as when the database is not produced. Yet, my issue is that i'm getting this error after i try to carry out a query to place an archive.

ERROR/Database(214): Failure 1 (table Sample already exists) on 0x218688 when preparing 
'CREATE TABLE Sample (RecId INT, SampleDesc TEXT);'.

The only real place this Create totally utilized in code may be the OnCreate method which appears like this.

 @Override
      public void onCreate(SQLiteDatabase db) {
          db.execSQL(SAMPLE_TABLE_CREATE);
      }

Note: I am carrying out a tutorial - the only real factor I have done different is result in the SQLiteDatabase object public rather than private to ensure that I possibly could extend these kinds for every entity, letting the general public SQLiteDatabase object in the inherited DataHelper class do everything

This is actually the method which makes the phone call that fails.

 //This method is in the class that extends DataHelper (See note on tutorial)
    public void createSample(Sample sample)//next action form
    {           
            String id =  sample.getId();
            String name =  sample.getSummary();

            String query = "INSERT INTO " + SAMPLE_TABLE_NAME + "( " + SAMPLE_Id + "," + 
                        SAMPLE_NAME + ") " + " VALUES (" + id + "," + name + ")";

            try{        
                 data.rawQuery(query, null);    
            }
            catch(SQLException e){
                 Log.i("Sample", "Errors: Sample LN60: " + e.getMessage());   
            }
    }

Can someone let me know what I am doing wrong? Or simply a hack (i.e. see if table is available before performing create statement)

Please tell me the other code I'm able to publish to resolve this...

Could it be because of you've carry it out your activity once rather than destroy the DB next? And second run you'd hit this error.

Database is saved in /data/data/YOUR_PACKAGE/databases/, so a workaround is always to see if the DB is available here before creating it.

    //The Android's default system path of your application database.
    private static String DB_PATH = "/data/data/YOUR_PACKAGE/databases/";
    private static String DB_NAME = "myDBName";

    SQLiteDatabase checkDB = null;

    String myPath = DB_PATH + DB_NAME;
    checkDB = SQLiteDatabase.openDatabase(myPath, null, SQLiteDatabase.OPEN_READONLY);
    if(checkDB){
      //do nothing
    }else{
      //create DB
    }

Code source here

The very first error is very due to the fact you're developing a table that already is available, so yes adding a cheque when the table is available just before creating it might be good. Once an SQLite dB is produced or managed to get will remain until someone or something like that removes it, unlike the default onCreate() call which resembles re-creating or drawing your screen.

any time you call getWritableDatabase() onCreate() technique is known as.