android - SimpleCursorAdapter crashing -


android keep crashing hits line "simplecursoradapter notesadapter = new simplecursoradapter(this, r.layout.manage_notes_noteitem_layout,)

i've tried changing sorts of things, creating separate class adapter, adapter class proves problematic. either it's "this"/context or custom layout. i'm unsure , have been looking around answers.

thanks in advance.

        string[] columns = new string[] {         notesadapter.key_notetitle,         notesadapter.key_created,         notesadapter.key_notetext,       };        // xml defined views data bound       int[] = new int[] {          r.id.note_title,         r.id.note_datedcreated,         r.id.note_details,       };        // create adapter using cursor pointing desired data        //as layout information       simplecursoradapter notesadapter = new simplecursoradapter(         this, r.layout.manage_notes_noteitem_layout,          c,          columns,          to,         0); 

update notesadapter class:

public class notesadapter extends dbadapter  {  public static final string key_noteid = "noteid"; public static final string key_notetitle = "notetitle"; public static final string key_notetext = "notetext"; public static final string key_created = "created"; private static final string database_table = "notes";  public notesadapter(context ctx) {     super(ctx); }  public long create(string noteid, string notetitle, string notetext, string created) {     contentvalues args = new contentvalues();     args.put(key_noteid,noteid);     args.put(key_notetitle,notetitle);     args.put(key_notetext,notetext);     args.put(key_created,created);      return mdb.insert(database_table, null,args); }  public boolean delete(string rowid) {     return mdb.delete(database_table, key_noteid + "=" + rowid, null) > 0; }  public cursor fetchall() {     return mdb.query(database_table, new string[] {key_noteid, key_notetitle, key_notetext, key_created}, null, null, null, null, null); }  public cursor fetch(long rowid) throws sqlexception {     cursor mcursor =         mdb.query(true, database_table, new string[] {key_noteid, key_notetitle, key_notetext, key_created}, key_noteid + "=" + rowid, null,                 null, null, null, null);     if (mcursor != null) {         mcursor.movetofirst();     }     return mcursor; } 

}

edit: cursor return valid values because tested using toasts.


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -