I'm trying to insert one row with id
and timestamp
into a sqlite database by clicking in my android app on virtual device.
private final String create_table = "CREATE TABLE clicks ( id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, timestamp INTEGER(4) NOT NULL);";
db.execSQL("insert into clicks(timestamp) values (strftime(\"%s\", CURRENT_TIME));");
When I run the app inserts three rows into the db instead of one row?
Any suggestion?
Here the MainActivity :
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SQLite sqlite = new SQLite( this );
sqlite.open();
sqlite.insert();
sqlite.close();
System.exit(0);
}
}
When I close it, the app restarts twice. "System.exit(0)"
02-21 18:10:11.558 2232-2232/? I/art: System.exit called, status: 0
02-21 18:10:11.558 2232-2232/? I/AndroidRuntime: VM exiting with result code 0, cleanup skipped.
02-21 18:10:11.575 1203-1216/? I/ActivityManager: Process com.click.nautilus.click (pid 2232) has died
02-21 18:10:11.581 2246-2246/? I/art: Not late-enabling -Xcheck:jni (already on)
02-21 18:10:11.595 1203-1216/? I/ActivityManager: Start proc 2246:com.click.nautilus.click/u0a54 for activity com.click.nautilus.click/.MainActivity