java - Android project: errors after changing machine -


so more halfway through book, android programming: big nerd ranch guide, , finished criminalintent app when had change desktop laptop. copied workspace , installed eclipse , sdk. logcat gives me when trying add new crime:

06-13 09:10:47.720: e/androidruntime(535): java.lang.nullpointerexception 06-13 09:10:47.720: e/androidruntime(535):  @ com.bignerdranch.android.criminalintent.crimefragment.oncreateview(crimefragment.java:102) 06-13 09:10:47.720: e/androidruntime(535):  @ android.support.v4.app.fragment.performcreateview(fragment.java:1789) 06-13 09:10:47.720: e/androidruntime(535):  @ android.support.v4.app.fragmentmanagerimpl.movetostate(fragmentmanager.java:955) 06-13 09:10:47.720: e/androidruntime(535):  @ android.support.v4.app.fragmentmanagerimpl.movetostate(fragmentmanager.java:1138) 06-13 09:10:47.720: e/androidruntime(535):  @ android.support.v4.app.backstackrecord.run(backstackrecord.java:740) 06-13 09:10:47.720: e/androidruntime(535):  @ android.support.v4.app.fragmentmanagerimpl.execpendingactions(fragmentmanager.java:1501) 06-13 09:10:47.720: e/androidruntime(535):  @ android.support.v4.app.fragmentmanagerimpl.executependingtransactions(fragmentmanager.java:490) 06-13 09:10:47.720: e/androidruntime(535):  @ android.support.v4.app.fragmentstatepageradapter.finishupdate(fragmentstatepageradapter.java:163) 06-13 09:10:47.720: e/androidruntime(535):  @ android.support.v4.view.viewpager.populate(viewpager.java:1072) 06-13 09:10:47.720: e/androidruntime(535):  @ android.support.v4.view.viewpager.populate(viewpager.java:918) 06-13 09:10:47.720: e/androidruntime(535):  @ android.support.v4.view.viewpager.onmeasure(viewpager.java:1440) 

line 102 @ crimefragment is:

getactivity().getactionbar().setdisplayhomeasupenabled(true); 

maybe there difference in new support library? weird, did previous setup month ago.

another thing first installed android studio , sdk, , pointed eclipse sdk, maybe problem? code working on old machine not posting here, if need can.

edit:

@targetapi(11) public view oncreateview(layoutinflater inflater, viewgroup parent, bundle savedinstancestate) {     /* int resource, viewgroup root, boolean attachtoroot */     view v = inflater.inflate(r.layout.fragment_crime, parent, false);     // enabling button on menu bar shown     if (build.version.sdk_int >= build.version_codes.honeycomb) {         /*          * action bar (guess button in particular) compatible holo.light          * theme, maybe others idk. there way around complicated, need          * use supportactionbar          */         if (navutils.getparentactivityname(getactivity()) != null) {             getactivity().getactionbar().setdisplayhomeasupenabled(true);         }     }      mtitlefield = (edittext) v.findviewbyid(r.id.crime_title);     mtitlefield.settext(mcrime.gettitle());     mtitlefield.addtextchangedlistener(new textwatcher() {         public void ontextchanged(charsequence c, int start, int before, int count) {             mcrime.settitle(c.tostring());         }          @override         public void beforetextchanged(charsequence s, int start, int count, int after) {          }          @override         public void aftertextchanged(editable s) {          }     });      mdatebutton = (button) v.findviewbyid(r.id.crime_date);     mdatebutton.setonclicklistener(new view.onclicklistener() {         /*          * standard procedure of sending info between fragments of same activity - use          * newinstance          */         @override         public void onclick(view v) {             fragmentmanager fm = getactivity().getsupportfragmentmanager();             datepickerfragment dialog = datepickerfragment.newinstance(mcrime.getdate());             /*              * setting target receive request_date after child dead; first set              * request_date string; used private void sendresult(int              * resultcode) , dialoginterface.onclicklistener in positive button in              * datepickerfragment, overriding onactivityresult necessary in here              */             dialog.settargetfragment(crimefragment.this, request_date);             dialog.show(fm, dialog_date);         }     });      mtimebutton = (button) v.findviewbyid(r.id.crime_time);     mtimebutton.setonclicklistener(new view.onclicklistener() {         @override         public void onclick(view v) {             fragmentmanager fm = getactivity().getsupportfragmentmanager();             timepickerfragment dialog = timepickerfragment.newinstance(mcrime.getdate());             dialog.settargetfragment(crimefragment.this, request_time);             dialog.show(fm, dialog_time);         }     });     mdeletebutton = (button) v.findviewbyid(r.id.crime_delete);     mdeletebutton.settext(r.string.delete_crime);     mdeletebutton.setonclicklistener(new view.onclicklistener() {         @override         public void onclick(view v) {             uuid crimeid = (uuid) getarguments().getserializable(extra_crime_id);             crimelab crimelab = crimelab.get(getactivity());             crime crime = crimelab.get(getactivity()).getcrime(crimeid);             crimelab.deletecrime(crime);             crimelab.savecrimes();             getactivity().finish();         }     });     mphotobutton = (imagebutton) v.findviewbyid(r.id.crime_imagebutton);     mphotobutton.setonclicklistener(new view.onclicklistener() {         @override         public void onclick(view v) {             intent = new intent(getactivity(), crimecameraactivity.class);             startactivity(i);         }     });     // disabling camera button devices without camera     packagemanager pm = getactivity().getpackagemanager();     if (!pm.hassystemfeature(packagemanager.feature_camera)                     && !pm.hassystemfeature(packagemanager.feature_camera_front)) {         mphotobutton.setenabled(false);     }      msolvedcheckbox = (checkbox) v.findviewbyid(r.id.crime_solved);     msolvedcheckbox.setchecked(mcrime.issolved());     msolvedcheckbox.setoncheckedchangelistener(new oncheckedchangelistener() {         public void oncheckedchanged(                         /* checkbutton needs compoundbutton */compoundbutton buttonview,                         boolean ischecked) {             mcrime.setsolved(ischecked);         }     });     updatedate();     updatetime();     return v; } 

it states out actionbar null. if you're using support library try

getactivity().getsupportactionbar().setdisplayhomeasupenabled(true); 

instead of

getactivity().getactionbar().setdisplayhomeasupenabled(true); 

Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -