In my application i have an database in that i have 2 tables.I have 2 following queries:
1.Is it possible to create database with some default value??
2.I have 1 screen in that i have 5 edit boxes,1 save button.When user press the save button the 5 edit boxes value should be updated (replace the old) in the database?
Please help me.
This is for creating database:
private static final String DATABASE_SPIN=
"create table spinner(_id integer primary key autoincrement,"+" spin text not null);";
This is exesql:
public void onCreate(SQLiteDatabase db)
{
db.execSQL(DATABASE_SPIN);
}
My populate code is:
Cursor c=db.getAllTitlesSpin();
startManagingCursor(c);
int spinColumnIndex = c.getColumnIndexOrThrow("spin");
// String group[]=getResources().getStringArray(R.array.group_array);
ArrayAdapter<String> adapter1 = new ArrayAdapter<String>(
this, android.R.layout.simple_spinner_item);
adapter1.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
s2.setAdapter(adapter1);
if (c.moveToFirst()) {
do {
adapter1.add(c.getString(spinColumnIndex));
}
while (c.moveToNext());
if (db != null) {
db.close();
}
}
Selectquery (CREATE TABLE … AS SELECT Statements )INSERT INTO Destination SELECT * FROM Source;