I fetch record from database using following code.
for (LocWiseProfileBeans cn : LocWiseProfile) {
// get a reference for the TableLayout
TableLayout table = (TableLayout) findViewById(R.id.locprofile_table);
// create a new TableRow
TableRow row = new TableRow(this);
// count the counter up by one
counter++;
String log = "Loc Name: "+cn.getLocname()+" ,Lattitude: " + cn.getLattitude()+ " ,Longitude: " + cn.getLongitude()+ " , Selected Profile :"+cn.getSelectedprofile();
TextView t = new TextView(this);
// set the text to "text xx"
t.setText(cn.getLocname());
TextView t2 = new TextView(this);
t2.setText(cn.getSelectedprofile());
row.addView(t);
row.addView(t2);
table.addView(row,new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
But i need to enable this record for deletion on user request.
Means if user click on second record then this record will be delete.
I try to find the answer but not find any appropriate answer…….
Please provide me reference code or article.
Thank you in Advance!
You can do this by setting onClickListener to your row.
To determine which row is clicked, you can set a unique tag to that row.
If you want to simply display the result from db as a list, I suggest you using ListActivity or ListView, with using adapter you can show and manage your data in more simple way.