user2423214
user2423214

Reputation: 1

Delete from table onClickListener

 delete.setOnClickListener(new OnClickListener(){

                @Override
                public void onClick(View v) {
                    Cursor c= myDB.rawQuery("DELETE FROM contacts where id_ctc='"+t+"'",null);
                    Intent i = new Intent(Dial.this,TabLayout.class);
                    startActivity(i);
                }         
              });

the application stops working (Unfortunately, Tablayout has stopprd.)

Upvotes: 0

Views: 61

Answers (1)

Waddas
Waddas

Reputation: 1402

public void onClick(View v) {
    myDB.delete(TABLE_CONTACTS, id_ctc + " = ?", new String[] { String.valueOf(t) });
    Cursor c= myDB.rawQuery("DELETE FROM contacts where id_ctc='"+t+"'",null);
    Intent i = new Intent(Dial.this,TabLayout.class);
    startActivity(i);
}     

Upvotes: 1

Related Questions