Reputation: 1297
I try this tutorial to load Spinner
from sqlite
and mysql
.
Tthe tutorial works, but this app can't load from mysql
twice.
So this app is load mysql
when first debugging only or when data is empty.
when i try to clear data, the app is load mysql.
I try modificate and create a button
to update sqlite
from mysql
but i dont now how.
How to create a button to update sqlite from mysql, so when i click the button
, the spinner
value is change and load value from mysql
?
BR
Alex
Upvotes: 2
Views: 688
Reputation: 132992
Currently you are not opening database for deletion :
Change your SpinnerUpdate
method as in MySQLite
Activity:
private void SpinnerUpdate(){
// database handler
dh = new DatabaseHandler(getApplicationContext());
dh.loadAll();
}
and Change your loadAll
method as in DatabaseHandler
:
public void loadAll() {
//context.deleteDatabase(DATABASE_NAME);
SQLiteDatabase db = this.getWritableDatabase();
db.delete(DatabaseHandler.TABLE_LABELS, null, null);
}
Upvotes: 1