Friday, July 1, 2011

Db to get ID

db=new DataHelper(EatOut_details.this);
db.open();
Cursor res=db.getFeed(Story_id);

if(res==null || res.getCount()<=0){

btn_favourite.setBackgroundResource(R.drawable.added);
try{
db.insert(Story_id,1,2,3,4,5,sub_6);
}catch (Exception e) {
Log.e("1", "Error while Querying - "+e);
}

Toast.makeText(this, " dded", Toast.LENGTH_SHORT).show();

res.close();

}else{

btn_favourite.setBackgroundResource(R.drawable.icon);

try{
db.deleteFeed(Story_id);
}catch (Exception e) {
Log.e("ram", "Error while Querying - "+e);

}
Toast.makeText(this, " Removed", Toast.LENGTH_SHORT).show();
res.close();
}
db.close();

No comments:

Post a Comment