Hi,
Can anyone point me in the right direction please. I used the notepad
example on android's site and created a listActivity which uses a
database to fill out the list. However, every row has a delete button
and I want to listen for a click of that button and then delete the
row from listView. Is there a way I can do that?
Here's the code:
alert_row.xml
====================================
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
>
<Button android:id="@+id/btnDelete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Delete"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" "
/>
Exp.java
======================================
private void fillData() {
try {
Cursor c = db.fetchAllAlerts();
startManagingCursor(c);
SimpleCursorAdapter sca = new SimpleCursorAdapter(this,
R.layout.alert_row,
c,
new String[] {AlertDB.KEY_ALERT_TEXT},
new int[] {R.id.scol1});
this.setListAdapter(sca);
} catch (Exception e) {
Log.e("ERROR", "ERROR IN CODE:"+e.toString());
}
}
The onCreate method of this class doesn't set a contentView as the
class extends ListView (and I always get an error when I try to do
that)
Thanks in advance,
Moazzam
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---