I\'m trying to make ListView populated from database, and spice each row with fancy delete button. So I made list Activity and custom SimpleCursorAdapter.
This is main Li
The problem is in your SMSimpleCursorAdapter code:
EditEntries dbDel = new EditEntries(); //from previous code sample
You create a new object but it won't be a managed Activity (eg. the onCreate method won't be called). The NPE probably comes from your DBAdapter when you try to create it the second time (from your Adapter).
Quick fix:
EditEntries dbDel; //from previous code sample
public SMSimpleCursorAdapter(Context context, int layout, Cursor c,
String[] from, int[] to) {
super(context, layout, c, from, to);
this.c = c;
this.context = context;
this.activity = (Activity) context;
this.dbDel = (EditEntries) context;
}
If you don't want just a quick fix the following would be a much better solution: