mercredi 25 novembre 2015

Database not getting created using SQLiteOpenHelper

I am a newbie in Android and am learning the SQLite databases.But somehow the database is not getting created using the following code:

package com.example.sqllitetest;


public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    SQLHelper s = new SQLHelper(this);

}


public class SQLHelper extends SQLiteOpenHelper {



    public SQLHelper(Context c)
    {

        super(c,"test",null,1);


    }

    @Override
    public void onCreate(SQLiteDatabase database) {
        database.execSQL("Create Table TESTING (_id integer primary key,name  text);");
    }

    @Override
    public void onUpgrade(SQLiteDatabase database, int arg1, int arg2) {

    }

}

}

But it seems the database "test" is not getting created. Please help me on this issue. Logcat:

 11-25 23:23:30.824: E/SQLiteLog(28496): (283) recovered 103 frames from WAL file /data/user/0/com.android.providers.media/databases/external.db-wal
 11-25 23:23:33.391: E/msm8974_platform(302): platform_update_tpa_poll: Could not get ctl for mixer cmd - TPA6165 POLL ACC DET
 11-25 23:23:37.351: E/OMX-VDEC-1080P(302): Failed to enable dynamic buffer mode
  11-25 23:23:37.352: E/OMXNodeInstance(302): OMX_SetParameter() failed for StoreMetaDataInBuffers: 0x80001019
  11-25 23:23:37.352: E/ACodec(302): [OMX.qcom.video.decoder.mpeg4] storeMetaDataInBuffers failed w/ err -2147483648
  11-25 23:23:37.371: E/C2DColorConvert(302): unknown format passed for luma alignment number
  11-25 23:23:37.426: E/C2DColorConvert(302): unknown format passed for luma   alignment number
  11-25 23:23:37.426: E/C2DColorConvert(302): unknown format passed for luma alignment number
  11-25 23:33:14.274: E/PMBA(846): No global metadata in state file!
  11-25 23:33:14.396: E/SQLiteLog(32611): (1) no such table: mmsconfig
  11-25 23:33:14.403: E/Babel(32611): canonicalizeMccMnc: invalid mccmnc nullnull
  11-25 23:33:34.053: E/NetlinkEvent(298): NetlinkEvent::FindParam(): Parameter 'TIME_NS' not found
  11-25 23:33:36.619: E/WifiStateMachine(846): handleScreenStateChanged Exit: false
  11-25 23:33:36.623: E/WifiStateMachine(846): setSuspendOptimizationsNative: 4 true -want true stack:setSuspendOptimizationsNative - access$14300 - processMessage - processMsg
 11-25 23:33:36.624: E/WifiStateMachine(846): setSuspendOptimizationsNative do it 4 true stack:setSuspendOptimizationsNative - access$14300 - processMessage - processMsg
 11-25 23:33:36.624: E/native(846): do suspend true

Aucun commentaire:

Enregistrer un commentaire