Entering data manually into a table (Android)

Asked

Viewed 322 times

0

My project has a Textview that should already start displaying a value to the user, this will only have to change it. But, this value is not being displayed. I believe it is not being saved. How do I insert this initial value into the table?

This is the code I’m using and it doesn’t work:

public void onCreate(SQLiteDatabase bd) {
    bd.execSQL("create table dados(_id integer primary key autoincrement, data text not null);");
    String sql = "INSERT INTO dados (data) values('DD/MM/AAAA')";
    bd.execSQL(sql);
}
  • What’s not working out?

  • I want when the program is first started by the user, a date already appears for the user so that he can only edit it later. But this initial date I’m trying to put up is not recording in the bank.

  • And while this date is not changed by the user, the one that was initially entered remains.

  • It has how to check whether the method onCreate is being called? At the same time, it could include the code that retrieves the BD record and the SQLiteOpenHelper?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.