java - Android App crashes at setadapter function for arrayadapters -
my app crashing once setadapter function called , stumped. according logcat null exception cannot seem figure out issue. appreciated!
here main
package com.example.ridehistory; import java.text.simpledateformat; import java.util.arraylist; import java.util.date; import android.os.bundle; import android.app.activity; import android.view.menu; import android.view.menuitem; import android.view.view; import android.widget.listview; import android.support.v4.app.navutils; import android.annotation.targetapi; import android.os.build; public class mainactivity extends activity { private listview ridehistorylistview; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); // show button in action bar. //setupactionbar(); //initialize fake data arraylist<string> array1 = new arraylist<string>(); array1.add("first passenger1"); arraylist<string> array2 = new arraylist<string>(); array2.add("first passenger2"); arraylist<string> array3 = new arraylist<string>(); array3.add("first passenger3"); arraylist<string> array4 = new arraylist<string>(); array4.add("first passenger4"); arraylist<string> array5 = new arraylist<string>(); array5.add("first passenger5"); simpledateformat date1 = new simpledateformat("1/2/80"); simpledateformat date2 = new simpledateformat("2/3/80"); simpledateformat date3 = new simpledateformat("3/4/80"); simpledateformat date4 = new simpledateformat("4/5/80"); simpledateformat date5 = new simpledateformat("5/6/80"); //start of actual code ridetransaction ride_data[] = new ridetransaction[] { new ridetransaction("a","last",array1,"sf","la",date1), new ridetransaction("b", "last", array2, "la", "sd", date2), new ridetransaction("c", "last", array3, "sf", "ny", date3), new ridetransaction("d", "last", array4, "sf", "sd", date4), new ridetransaction("e" , "last", array5, "irvine", "la", date5) }; ridehistoryadapter adapter = new ridehistoryadapter(this, r.layout.listview_item_row, ride_data); ridehistorylistview = (listview)findviewbyid(r.id.ridehistorylistview); //ridehistoryadapter adapter = new ridehistoryadapter(this); view header = (view)getlayoutinflater().inflate(r.layout.listview_header_row, null); ridehistorylistview.addheaderview(header); ridehistorylistview.setadapter(adapter); } /** * set {@link android.app.actionbar}, if api available. */ /* @targetapi(build.version_codes.honeycomb) private void setupactionbar() { if (build.version.sdk_int >= build.version_codes.honeycomb) { getactionbar().setdisplayhomeasupenabled(true); } } @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu; adds items action bar if present. getmenuinflater().inflate(r.menu.ride_history, menu); return true; } @override public boolean onoptionsitemselected(menuitem item) { switch (item.getitemid()) { case android.r.id.home: // id represents home or button. in case of // activity, button shown. use navutils allow users // navigate 1 level in application structure. // more details, see navigation pattern on android design: // // http://developer.android.com/design/patterns/navigation.html#up-vs-back // navutils.navigateupfromsametask(this); return true; } return super.onoptionsitemselected(item); }*/ }
here adapter
package com.example.ridehistory; import android.app.activity; import android.content.context; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.arrayadapter; import android.widget.textview; public class ridehistoryadapter extends arrayadapter<ridetransaction>{ context context; int layoutresourceid; ridetransaction data[] = null; public ridehistoryadapter(context context, int layoutresourceid, ridetransaction[] data) { super( context, layoutresourceid, data); this.context = context; this.layoutresourceid = layoutresourceid; this.data = data; } @override public view getview(int position, view convertview, viewgroup parent) { view row = convertview; ridetransactionholder holder = null; if(row == null) { layoutinflater inflater = ((activity)context).getlayoutinflater(); row = inflater.inflate(layoutresourceid, parent, false); holder = new ridetransactionholder(); holder.txtfirstname = (textview)row.findviewbyid(r.id.txtfirstname); holder.txtlastname = (textview)row.findviewbyid(r.id.txtlastname); holder.txtpassengers = (textview)row.findviewbyid(r.id.txtpassengers); holder.txtstartlocation = (textview)row.findviewbyid(r.id.txtstartlocation); holder.txtendlocation = (textview)row.findviewbyid(r.id.txtendlocation); row.settag(holder); } else { holder = (ridetransactionholder)row.gettag(); } ridetransaction ridetransaction = data[position]; holder.txtfirstname.settext(ridetransaction.firstname); holder.txtlastname.settext(ridetransaction.lastname); holder.txtpassengers.settext("hmm"); holder.txtstartlocation.settext(ridetransaction.startlocation); holder.txtendlocation.settext(ridetransaction.endlocation); holder.txtdatetime.settext(ridetransaction.datetime.tostring()); return row; } static class ridetransactionholder { textview txtfirstname; textview txtlastname; textview txtpassengers; textview txtstartlocation; textview txtendlocation; textview txtdatetime; } }
this ride transaction
package com.example.ridehistory; import java.text.simpledateformat; import java.util.arraylist; import java.util.date; public class ridetransaction { public string firstname; public string lastname; public arraylist<string> passengers; //some kind promptness rating..? public string startlocation; public string endlocation; public simpledateformat datetime; public ridetransaction() { super(); } public ridetransaction(string firstname, string lastname, arraylist<string> passengers, string startlocation, string endlocation, simpledateformat datetime) { this.firstname = firstname; this.lastname = lastname; this.passengers = passengers; this.startlocation = startlocation; this.endlocation = endlocation; this.datetime = datetime; } }
this main xml
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context=".mainactivity" > <listview android:id="@+id/ridehistorylistview" android:layout_width = "fill_parent" android:layout_height="fill_parent" /> </relativelayout>
this item row xml
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="10dp"> <textview android:id="@+id/txtdatetime" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center_horizontal" android:text="date" /> <textview android:id="@+id/txtfirstname" android:layout_width="wrap_content" android:layout_height = "wrap_content" android:gravity="center_horizontal" android:layout_below="@id/txtdatetime" android:text="first" /> <textview android:id="@+id/txtlastname" android:layout_width="wrap_content" android:layout_height = "wrap_content" android:layout_alignparenttop="true" android:layout_torightof="@id/txtfirstname" android:layout_below="@id/txtdatetime" android:gravity="center_horizontal" android:text="last" /> <textview android:id="@+id/txtpassengers" android:layout_width = "wrap_content" android:layout_height = "wrap_content" android:gravity="center_horizontal" android:layout_below="@id/txtfirstname" android:text="passengers" /> <textview android:id="@+id/txtstartlocation" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center_horizontal" android:layout_below="@id/txtpassengers" android:text="start" /> <textview android:id="@+id/txtendlocation" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/txtpassengers" android:layout_torightof="@id/txtstartlocation" android:gravity="center_horizontal" android:text="end" /> </relativelayout>
this item header
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent"> <textview android:id="@+id/txtheader" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="center_vertical" android:layout_alignparenttop="true" android:layout_alignparentbottom="true" android:textstyle="bold" android:textsize="22dp" android:textcolor="#ffffff" android:padding="10dp" android:text="ride transaction" android:background="#336699" /> </linearlayout>
this logcat
05-03 01:26:27.087: w/dalvikvm(272): threadid=1: thread exiting uncaught exception (group=0x4001d800) 05-03 01:26:27.107: e/androidruntime(272): fatal exception: main 05-03 01:26:27.107: e/androidruntime(272): java.lang.nullpointerexception 05-03 01:26:27.107: e/androidruntime(272): @ com.example.ridehistory.ridehistoryadapter.getview(ridehistoryadapter.java:52) 05-03 01:26:27.107: e/androidruntime(272): @ android.widget.headerviewlistadapter.getview(headerviewlistadapter.java:220) 05-03 01:26:27.107: e/androidruntime(272): @ android.widget.abslistview.obtainview(abslistview.java:1315) 05-03 01:26:27.107: e/androidruntime(272): @ android.widget.listview.makeandaddview(listview.java:1727) 05-03 01:26:27.107: e/androidruntime(272): @ android.widget.listview.filldown(listview.java:652) 05-03 01:26:27.107: e/androidruntime(272): @ android.widget.listview.fillfromtop(listview.java:709) 05-03 01:26:27.107: e/androidruntime(272): @ android.widget.listview.layoutchildren(listview.java:1580) 05-03 01:26:27.107: e/androidruntime(272): @ android.widget.abslistview.onlayout(abslistview.java:1147) 05-03 01:26:27.107: e/androidruntime(272): @ android.view.view.layout(view.java:7035) 05-03 01:26:27.107: e/androidruntime(272): @ android.widget.relativelayout.onlayout(relativelayout.java:909) 05-03 01:26:27.107: e/androidruntime(272): @ android.view.view.layout(view.java:7035) 05-03 01:26:27.107: e/androidruntime(272): @ android.widget.framelayout.onlayout(framelayout.java:333) 05-03 01:26:27.107: e/androidruntime(272): @ android.view.view.layout(view.java:7035) 05-03 01:26:27.107: e/androidruntime(272): @ android.widget.linearlayout.setchildframe(linearlayout.java:1249) 05-03 01:26:27.107: e/androidruntime(272): @ android.widget.linearlayout.layoutvertical(linearlayout.java:1125) 05-03 01:26:27.107: e/androidruntime(272): @ android.widget.linearlayout.onlayout(linearlayout.java:1042) 05-03 01:26:27.107: e/androidruntime(272): @ android.view.view.layout(view.java:7035) 05-03 01:26:27.107: e/androidruntime(272): @ android.widget.framelayout.onlayout(framelayout.java:333) 05-03 01:26:27.107: e/androidruntime(272): @ android.view.view.layout(view.java:7035) 05-03 01:26:27.107: e/androidruntime(272): @ android.view.viewroot.performtraversals(viewroot.java:1045) 05-03 01:26:27.107: e/androidruntime(272): @ android.view.viewroot.handlemessage(viewroot.java:1727) 05-03 01:26:27.107: e/androidruntime(272): @ android.os.handler.dispatchmessage(handler.java:99) 05-03 01:26:27.107: e/androidruntime(272): @ android.os.looper.loop(looper.java:123) 05-03 01:26:27.107: e/androidruntime(272): @ android.app.activitythread.main(activitythread.java:4627) 05-03 01:26:27.107: e/androidruntime(272): @ java.lang.reflect.method.invokenative(native method) 05-03 01:26:27.107: e/androidruntime(272): @ java.lang.reflect.method.invoke(method.java:521) 05-03 01:26:27.107: e/androidruntime(272): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:868) 05-03 01:26:27.107: e/androidruntime(272): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:626) 05-03 01:26:27.107: e/androidruntime(272): @ dalvik.system.nativestart.main(native method) 05-03 01:26:36.588: i/process(272): sending signal. pid: 272 sig: 9 05-03 04:13:50.917: d/androidruntime(586): shutting down vm 05-03 04:13:50.917: w/dalvikvm(586): threadid=1: thread exiting uncaught exception (group=0x4001d800) 05-03 04:13:50.937: e/androidruntime(586): fatal exception: main 05-03 04:13:50.937: e/androidruntime(586): java.lang.nullpointerexception 05-03 04:13:50.937: e/androidruntime(586): @ com.example.ridehistory.ridehistoryadapter.getview(ridehistoryadapter.java:52) 05-03 04:13:50.937: e/androidruntime(586): @ android.widget.headerviewlistadapter.getview(headerviewlistadapter.java:220) 05-03 04:13:50.937: e/androidruntime(586): @ android.widget.abslistview.obtainview(abslistview.java:1315) 05-03 04:13:50.937: e/androidruntime(586): @ android.widget.listview.makeandaddview(listview.java:1727) 05-03 04:13:50.937: e/androidruntime(586): @ android.widget.listview.filldown(listview.java:652) 05-03 04:13:50.937: e/androidruntime(586): @ android.widget.listview.fillfromtop(listview.java:709) 05-03 04:13:50.937: e/androidruntime(586): @ android.widget.listview.layoutchildren(listview.java:1580) 05-03 04:13:50.937: e/androidruntime(586): @ android.widget.abslistview.onlayout(abslistview.java:1147) 05-03 04:13:50.937: e/androidruntime(586): @ android.view.view.layout(view.java:7035) 05-03 04:13:50.937: e/androidruntime(586): @ android.widget.relativelayout.onlayout(relativelayout.java:909) 05-03 04:13:50.937: e/androidruntime(586): @ android.view.view.layout(view.java:7035) 05-03 04:13:50.937: e/androidruntime(586): @ android.widget.framelayout.onlayout(framelayout.java:333) 05-03 04:13:50.937: e/androidruntime(586): @ android.view.view.layout(view.java:7035) 05-03 04:13:50.937: e/androidruntime(586): @ android.widget.linearlayout.setchildframe(linearlayout.java:1249) 05-03 04:13:50.937: e/androidruntime(586): @ android.widget.linearlayout.layoutvertical(linearlayout.java:1125) 05-03 04:13:50.937: e/androidruntime(586): @ android.widget.linearlayout.onlayout(linearlayout.java:1042) 05-03 04:13:50.937: e/androidruntime(586): @ android.view.view.layout(view.java:7035) 05-03 04:13:50.937: e/androidruntime(586): @ android.widget.framelayout.onlayout(framelayout.java:333) 05-03 04:13:50.937: e/androidruntime(586): @ android.view.view.layout(view.java:7035) 05-03 04:13:50.937: e/androidruntime(586): @ android.view.viewroot.performtraversals(viewroot.java:1045) 05-03 04:13:50.937: e/androidruntime(586): @ android.view.viewroot.handlemessage(viewroot.java:1727) 05-03 04:13:50.937: e/androidruntime(586): @ android.os.handler.dispatchmessage(handler.java:99) 05-03 04:13:50.937: e/androidruntime(586): @ android.os.looper.loop(looper.java:123) 05-03 04:13:50.937: e/androidruntime(586): @ android.app.activitythread.main(activitythread.java:4627) 05-03 04:13:50.937: e/androidruntime(586): @ java.lang.reflect.method.invokenative(native method) 05-03 04:13:50.937: e/androidruntime(586): @ java.lang.reflect.method.invoke(method.java:521) 05-03 04:13:50.937: e/androidruntime(586): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:868) 05-03 04:13:50.937: e/androidruntime(586): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:626) 05-03 04:13:50.937: e/androidruntime(586): @ dalvik.system.nativestart.main(native method) 05-03 04:18:50.997: i/process(586): sending signal. pid: 586 sig: 9 05-03 04:35:30.760: d/androidruntime(616): shutting down vm 05-03 04:35:30.760: w/dalvikvm(616): threadid=1: thread exiting uncaught exception (group=0x4001d800) 05-03 04:35:30.779: e/androidruntime(616): fatal exception: main 05-03 04:35:30.779: e/androidruntime(616): java.lang.nullpointerexception 05-03 04:35:30.779: e/androidruntime(616): @ com.example.ridehistory.ridehistoryadapter.getview(ridehistoryadapter.java:55) 05-03 04:35:30.779: e/androidruntime(616): @ android.widget.headerviewlistadapter.getview(headerviewlistadapter.java:220) 05-03 04:35:30.779: e/androidruntime(616): @ android.widget.abslistview.obtainview(abslistview.java:1315) 05-03 04:35:30.779: e/androidruntime(616): @ android.widget.listview.makeandaddview(listview.java:1727) 05-03 04:35:30.779: e/androidruntime(616): @ android.widget.listview.filldown(listview.java:652) 05-03 04:35:30.779: e/androidruntime(616): @ android.widget.listview.fillfromtop(listview.java:709) 05-03 04:35:30.779: e/androidruntime(616): @ android.widget.listview.layoutchildren(listview.java:1580) 05-03 04:35:30.779: e/androidruntime(616): @ android.widget.abslistview.onlayout(abslistview.java:1147) 05-03 04:35:30.779: e/androidruntime(616): @ android.view.view.layout(view.java:7035) 05-03 04:35:30.779: e/androidruntime(616): @ android.widget.relativelayout.onlayout(relativelayout.java:909) 05-03 04:35:30.779: e/androidruntime(616): @ android.view.view.layout(view.java:7035) 05-03 04:35:30.779: e/androidruntime(616): @ android.widget.framelayout.onlayout(framelayout.java:333) 05-03 04:35:30.779: e/androidruntime(616): @ android.view.view.layout(view.java:7035) 05-03 04:35:30.779: e/androidruntime(616): @ android.widget.linearlayout.setchildframe(linearlayout.java:1249) 05-03 04:35:30.779: e/androidruntime(616): @ android.widget.linearlayout.layoutvertical(linearlayout.java:1125) 05-03 04:35:30.779: e/androidruntime(616): @ android.widget.linearlayout.onlayout(linearlayout.java:1042) 05-03 04:35:30.779: e/androidruntime(616): @ android.view.view.layout(view.java:7035) 05-03 04:35:30.779: e/androidruntime(616): @ android.widget.framelayout.onlayout(framelayout.java:333) 05-03 04:35:30.779: e/androidruntime(616): @ android.view.view.layout(view.java:7035) 05-03 04:35:30.779: e/androidruntime(616): @ android.view.viewroot.performtraversals(viewroot.java:1045) 05-03 04:35:30.779: e/androidruntime(616): @ android.view.viewroot.handlemessage(viewroot.java:1727) 05-03 04:35:30.779: e/androidruntime(616): @ android.os.handler.dispatchmessage(handler.java:99) 05-03 04:35:30.779: e/androidruntime(616): @ android.os.looper.loop(looper.java:123) 05-03 04:35:30.779: e/androidruntime(616): @ android.app.activitythread.main(activitythread.java:4627) 05-03 04:35:30.779: e/androidruntime(616): @ java.lang.reflect.method.invokenative(native method) 05-03 04:35:30.779: e/androidruntime(616): @ java.lang.reflect.method.invoke(method.java:521) 05-03 04:35:30.779: e/androidruntime(616): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:868) 05-03 04:35:30.779: e/androidruntime(616): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:626) 05-03 04:35:30.779: e/androidruntime(616): @ dalvik.system.nativestart.main(native method) 05-03 04:35:35.667: i/process(616): sending signal. pid: 616 sig: 9 05-03 04:37:52.767: d/androidruntime(646): shutting down vm 05-03 04:37:52.777: w/dalvikvm(646): threadid=1: thread exiting uncaught exception (group=0x4001d800) 05-03 04:37:52.787: e/androidruntime(646): fatal exception: main 05-03 04:37:52.787: e/androidruntime(646): java.lang.nullpointerexception 05-03 04:37:52.787: e/androidruntime(646): @ com.example.ridehistory.ridehistoryadapter.getview(ridehistoryadapter.java:55) 05-03 04:37:52.787: e/androidruntime(646): @ android.widget.headerviewlistadapter.getview(headerviewlistadapter.java:220) 05-03 04:37:52.787: e/androidruntime(646): @ android.widget.abslistview.obtainview(abslistview.java:1315) 05-03 04:37:52.787: e/androidruntime(646): @ android.widget.listview.makeandaddview(listview.java:1727) 05-03 04:37:52.787: e/androidruntime(646): @ android.widget.listview.filldown(listview.java:652) 05-03 04:37:52.787: e/androidruntime(646): @ android.widget.listview.fillfromtop(listview.java:709) 05-03 04:37:52.787: e/androidruntime(646): @ android.widget.listview.layoutchildren(listview.java:1580) 05-03 04:37:52.787: e/androidruntime(646): @ android.widget.abslistview.onlayout(abslistview.java:1147) 05-03 04:37:52.787: e/androidruntime(646): @ android.view.view.layout(view.java:7035) 05-03 04:37:52.787: e/androidruntime(646): @ android.widget.relativelayout.onlayout(relativelayout.java:909) 05-03 04:37:52.787: e/androidruntime(646): @ android.view.view.layout(view.java:7035) 05-03 04:37:52.787: e/androidruntime(646): @ android.widget.framelayout.onlayout(framelayout.java:333) 05-03 04:37:52.787: e/androidruntime(646): @ android.view.view.layout(view.java:7035) 05-03 04:37:52.787: e/androidruntime(646): @ android.widget.linearlayout.setchildframe(linearlayout.java:1249) 05-03 04:37:52.787: e/androidruntime(646): @ android.widget.linearlayout.layoutvertical(linearlayout.java:1125) 05-03 04:37:52.787: e/androidruntime(646): @ android.widget.linearlayout.onlayout(linearlayout.java:1042) 05-03 04:37:52.787: e/androidruntime(646): @ android.view.view.layout(view.java:7035) 05-03 04:37:52.787: e/androidruntime(646): @ android.widget.framelayout.onlayout(framelayout.java:333) 05-03 04:37:52.787: e/androidruntime(646): @ android.view.view.layout(view.java:7035) 05-03 04:37:52.787: e/androidruntime(646): @ android.view.viewroot.performtraversals(viewroot.java:1045) 05-03 04:37:52.787: e/androidruntime(646): @ android.view.viewroot.handlemessage(viewroot.java:1727) 05-03 04:37:52.787: e/androidruntime(646): @ android.os.handler.dispatchmessage(handler.java:99) 05-03 04:37:52.787: e/androidruntime(646): @ android.os.looper.loop(looper.java:123) 05-03 04:37:52.787: e/androidruntime(646): @ android.app.activitythread.main(activitythread.java:4627) 05-03 04:37:52.787: e/androidruntime(646): @ java.lang.reflect.method.invokenative(native method) 05-03 04:37:52.787: e/androidruntime(646): @ java.lang.reflect.method.invoke(method.java:521) 05-03 04:37:52.787: e/androidruntime(646): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:868) 05-03 04:37:52.787: e/androidruntime(646): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:626) 05-03 04:37:52.787: e/androidruntime(646): @ dalvik.system.nativestart.main(native method) 05-03 04:37:56.817: i/process(646): sending signal. pid: 646 sig: 9 05-03 04:39:41.727: d/androidruntime(675): shutting down vm 05-03 04:39:41.727: w/dalvikvm(675): threadid=1: thread exiting uncaught exception (group=0x4001d800) 05-03 04:39:41.761: e/androidruntime(675): fatal exception: main 05-03 04:39:41.761: e/androidruntime(675): java.lang.nullpointerexception 05-03 04:39:41.761: e/androidruntime(675): @ com.example.ridehistory.ridehistoryadapter.getview(ridehistoryadapter.java:55) 05-03 04:39:41.761: e/androidruntime(675): @ android.widget.headerviewlistadapter.getview(headerviewlistadapter.java:220) 05-03 04:39:41.761: e/androidruntime(675): @ android.widget.abslistview.obtainview(abslistview.java:1315) 05-03 04:39:41.761: e/androidruntime(675): @ android.widget.listview.makeandaddview(listview.java:1727) 05-03 04:39:41.761: e/androidruntime(675): @ android.widget.listview.filldown(listview.java:652) 05-03 04:39:41.761: e/androidruntime(675): @ android.widget.listview.fillfromtop(listview.java:709) 05-03 04:39:41.761: e/androidruntime(675): @ android.widget.listview.layoutchildren(listview.java:1580) 05-03 04:39:41.761: e/androidruntime(675): @ android.widget.abslistview.onlayout(abslistview.java:1147) 05-03 04:39:41.761: e/androidruntime(675): @ android.view.view.layout(view.java:7035) 05-03 04:39:41.761: e/androidruntime(675): @ android.widget.relativelayout.onlayout(relativelayout.java:909) 05-03 04:39:41.761: e/androidruntime(675): @ android.view.view.layout(view.java:7035) 05-03 04:39:41.761: e/androidruntime(675): @ android.widget.framelayout.onlayout(framelayout.java:333) 05-03 04:39:41.761: e/androidruntime(675): @ android.view.view.layout(view.java:7035) 05-03 04:39:41.761: e/androidruntime(675): @ android.widget.linearlayout.setchildframe(linearlayout.java:1249) 05-03 04:39:41.761: e/androidruntime(675): @ android.widget.linearlayout.layoutvertical(linearlayout.java:1125) 05-03 04:39:41.761: e/androidruntime(675): @ android.widget.linearlayout.onlayout(linearlayout.java:1042) 05-03 04:39:41.761: e/androidruntime(675): @ android.view.view.layout(view.java:7035) 05-03 04:39:41.761: e/androidruntime(675): @ android.widget.framelayout.onlayout(framelayout.java:333) 05-03 04:39:41.761: e/androidruntime(675): @ android.view.view.layout(view.java:7035) 05-03 04:39:41.761: e/androidruntime(675): @ android.view.viewroot.performtraversals(viewroot.java:1045) 05-03 04:39:41.761: e/androidruntime(675): @ android.view.viewroot.handlemessage(viewroot.java:1727) 05-03 04:39:41.761: e/androidruntime(675): @ android.os.handler.dispatchmessage(handler.java:99) 05-03 04:39:41.761: e/androidruntime(675): @ android.os.looper.loop(looper.java:123) 05-03 04:39:41.761: e/androidruntime(675): @ android.app.activitythread.main(activitythread.java:4627) 05-03 04:39:41.761: e/androidruntime(675): @ java.lang.reflect.method.invokenative(native method) 05-03 04:39:41.761: e/androidruntime(675): @ java.lang.reflect.method.invoke(method.java:521) 05-03 04:39:41.761: e/androidruntime(675): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:868) 05-03 04:39:41.761: e/androidruntime(675): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:626) 05-03 04:39:41.761: e/androidruntime(675): @ dalvik.system.nativestart.main(native method) 05-03 04:39:46.888: i/process(675): sending signal. pid: 675 sig: 9 05-03 04:58:52.298: d/androidruntime(704): shutting down vm 05-03 04:58:52.298: w/dalvikvm(704): threadid=1: thread exiting uncaught exception (group=0x4001d800) 05-03 04:58:52.318: e/androidruntime(704): fatal exception: main 05-03 04:58:52.318: e/androidruntime(704): java.lang.nullpointerexception 05-03 04:58:52.318: e/androidruntime(704): @ com.example.ridehistory.ridehistoryadapter.getview(ridehistoryadapter.java:55) 05-03 04:58:52.318: e/androidruntime(704): @ android.widget.headerviewlistadapter.getview(headerviewlistadapter.java:220)
the nullpointerexception
occurs @ line holder.txtdatetime.settext(ridetransaction.datetime.tostring());
because u have not initialized holder.txtdatetime
.
initialize before using i.e., add line
holder.txtdatetime = (textview)row.findviewbyid(r.id.txtdatetime);
Comments
Post a Comment