Der Fehler sagt etwas wie (in der Nähe von "create": Syntaxfehler) beim Vorbereiten 'Tabelle erstellen Option ... Tabelle Ergebnis erstellen ... Ich werde einfach alle anderen Codes in meinem Programm so dass ich fragen kann, wenn mehr Probleme auftreten.Android - SQLite Tabelle Fehler erstellen
Das ist mein Tisch (in DBHelper.java):
public int addScore(String score, String difficulty){
ContentValues values = new ContentValues();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date scoredate = new Date();
values.put("score", score);
values.put("difficulty", difficulty);
values.put("date", dateFormat.format(scoredate));
return (int) db.insert(tableScore, null, values);
}`
:
final static String sqlcreate=
"create table option (id integer primary key autoincrement," +
"volume boolean not null, vibrate boolean not null, theme text not null) " +
"create table score (id integer primary key autoincrement," +
"score text not null, difficulty text not null, date date not null,);";
Das ist mein DBFunction.java ist
Und das ist mein OnClick():
if (v==btnadd){
String vol = tbtnvol.getText().toString();
String vib = tbtnvib.getText().toString();
String theme = themename.getText().toString();
options.open();
options.addOption(vol, vib, theme);
options.close();
Toast.makeText(this, "Data has been added", Toast.LENGTH_LONG).show();
}`
Oh, es ist nicht in meiner Abfrage enthalten, sorry .. Es soll "" sein, die, die Sie hier in Stackoverflow beim Schreiben von Codes eingeben .. Ich werde nur das beheben .. Ich werde versuchen, zuerst meine Tabelle in verschiedene Variablen zu trennen. –