dimanche 17 janvier 2016

How can I add password the sqlite database when I was creating?

I created sqlite database this like. No problem. How can I add password this database when I was create? I know this question asked before. But I want to do this with my codes. Thanks for helping. (Sorry my English grammar)

public class MyApp extends Activity implements OnClickListener {
SQLiteDatabase db;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    db = openOrCreateDatabase("/mnt/sdcard/mydatabase", Context.MODE_PRIVATE,   null);   
    db.execSQL("CREATE TABLE IF NOT EXISTS mytable(id INTEGER PRIMARY KEY   AUTOINCREMENT,  date VARCHAR(20), name VARCHAR(20), city VARCHAR(20));");

}

Aucun commentaire:

Enregistrer un commentaire