I create a registertable in SQLite
db and can I use this same table to save the favourite places related to that particular user. Can anyone tell me how to do that
public static final int DATABASE_VERSION = 2;
//private static final String KEY_ROWID = "_id";
//sql command to create the table
private static final String REGISTER_TABLE_CREATE ="Create table " + registertable + "("+VisitID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + ColName + " VARCHAR(15) ," +ColAdd + " VARCHAR(15) ," + ColEmailid + " VARCHAR(15),"+
ColContact + " INT(25)," +
ColPassword + " VARCHAR(15) ," +
Coldateofbirth + " VARCHAR(15)) ";
Below is the coding where I click on imagebutton to save the favourite What coding should i do in this part ?
imstar.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
if(turnoffon==0)
{
//Saved to database
imstar.setImageResource(R.drawable.stars);
// db.open(); //open the db coonection
//favplace=get
// Cursor c = db.getEmpValues();
// String getplace= String.valueOf(place_id);
// String c1=c.getString(c.getColumnIndex(db.ColEmailid));
// db.insert();
Toast.makeText(getApplicationContext(), "Saved to Favorits", Toast.LENGTH_LONG).show();
turnoffon=1;
}
else
{
//delete from database
imstar.setImageResource(R.drawable.starwithoutglow);
Toast.makeText(getApplicationContext(), "Delete from favorits", Toast.LENGTH_LONG).show();
turnoffon=0;
}
}
});
new backk().execute();
}
Aucun commentaire:
Enregistrer un commentaire