android - NewView in CustomCursorAdapter is not getting called -


i have customcursoradapter taking cursor activity.

public class pastjourneylistadapter extends cursoradapter {     private static final string tag = "<pastjourneylistadapter>";     private final layoutinflater minflater;     private cursor cursor;      @suppresswarnings("deprecation")     public pastjourneylistadapter(context context, cursor c) {         super(context, c);         cursor = c;         minflater = layoutinflater.from(context);         log.d(tag, "6" + c.getcolumncount() + c.getcount() );     }      @override     public void bindview(view view, context context, cursor cursor) {          log.d(tag, "1");         textview journeytitle = (textview) view.findviewbyid(r.id.past_journey_title);         journeytitle.settext(cursor.getstring(cursor.getcolumnindex("name")));          textview journeyplace = (textview) view.findviewbyid(r.id.past_journey_place);         journeyplace.settext(cursor.getstring(cursor.getcolumnindex("place")));          textview journeydate = (textview) view.findviewbyid(r.id.past_journey_date);         journeydate.settext(cursor.getstring(cursor.getcolumnindex("date")));      }      @override     public view newview(context context, cursor cursor, viewgroup parent) {         log.d(tag, "4");         final view view = minflater.inflate(r.layout.past_journey_list_item, parent, false);         return view;     }  } 

pastjourneylist.java

@override public void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.past_journey_list);      journeydatasource jds = new journeydatasource(this);     jds.open();     cursor c = jds.getalljourneys();      listview pastjourneylistview = (listview) findviewbyid(r.id.addfriendslist);     pastjourneylistviewadapter = new pastjourneylistadapter(getbasecontext(), c);     pastjourneylistview.setadapter(pastjourneylistviewadapter); } 

somehow getting nullpointerexception. also log shows neither newview() nor bindview getting called! however, constructor getting called , printing perfect results of cursor.

tia

**error log **

12-06 06:51:47.445: d/<pastjourneylistadapter>(2429): 671 12-06 06:51:47.455: d/androidruntime(2429): shutting down vm 12-06 06:51:47.455: w/dalvikvm(2429): threadid=1: thread exiting uncaught exception (group=0x415d78b0)  12-06 06:37:38.158: e/androidruntime(31796): fatal exception: main 12-06 06:37:38.158: e/androidruntime(31796): java.lang.runtimeexception: unable start activity componentinfo{com.example.memories/com.example.memories.pastjourney.pastjourneylist}: java.lang.nullpointerexception 12-06 06:37:38.158: e/androidruntime(31796):    @ android.app.activitythread.performlaunchactivity(activitythread.java:2266) 12-06 06:37:38.158: e/androidruntime(31796):    @ android.app.activitythread.handlelaunchactivity(activitythread.java:2316) 12-06 06:37:38.158: e/androidruntime(31796):    @ android.app.activitythread.access$600(activitythread.java:150) 12-06 06:37:38.158: e/androidruntime(31796):    @ android.app.activitythread$h.handlemessage(activitythread.java:1298) 12-06 06:37:38.158: e/androidruntime(31796):    @ android.os.handler.dispatchmessage(handler.java:99) 12-06 06:37:38.158: e/androidruntime(31796):    @ android.os.looper.loop(looper.java:213) 12-06 06:37:38.158: e/androidruntime(31796):    @ android.app.activitythread.main(activitythread.java:5225) 12-06 06:37:38.158: e/androidruntime(31796):    @ java.lang.reflect.method.invokenative(native method) 12-06 06:37:38.158: e/androidruntime(31796):    @ java.lang.reflect.method.invoke(method.java:525) 12-06 06:37:38.158: e/androidruntime(31796):    @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:741) 12-06 06:37:38.158: e/androidruntime(31796):    @ com.android.internal.os.zygoteinit.main(zygoteinit.java:557) 12-06 06:37:38.158: e/androidruntime(31796):    @ dalvik.system.nativestart.main(native method) 12-06 06:37:38.158: e/androidruntime(31796): caused by: java.lang.nullpointerexception 12-06 06:37:38.158: e/androidruntime(31796):    @ com.example.memories.pastjourney.pastjourneylist.oncreate(pastjourneylist.java:35) 12-06 06:37:38.158: e/androidruntime(31796):    @ android.app.activity.performcreate(activity.java:5133) 12-06 06:37:38.158: e/androidruntime(31796):    @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1087) 12-06 06:37:38.158: e/androidruntime(31796):    @ android.app.activitythread.performlaunchactivity(activitythread.java:2230) 12-06 06:37:38.158: e/androidruntime(31796):    ... 11 more 


Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -