How handel runtime exception that occured when try to make my app compatible for android 3.0? -



How handel runtime exception that occured when try to make my app compatible for android 3.0? -

i wrote application compatible android 4.2. today tried install in api 11 , next error

06-24 13:30:22.848: e/androidruntime(645): fatal exception: main 06-24 13:30:22.848: e/androidruntime(645): java.lang.runtimeexception: unable start activity componentinfo{nebeek.literary.babataher/nebeek.literary.babataher.mainactivity}: java.lang.nullpointerexception 06-24 13:30:22.848: e/androidruntime(645): @ android.app.activitythread.performlaunchactivity(activitythread.java:1736) 06-24 13:30:22.848: e/androidruntime(645): @ android.app.activitythread.handlelaunchactivity(activitythread.java:1752) 06-24 13:30:22.848: e/androidruntime(645): @ android.app.activitythread.access$1500(activitythread.java:123) 06-24 13:30:22.848: e/androidruntime(645): @ android.app.activitythread$h.handlemessage(activitythread.java:993) 06-24 13:30:22.848: e/androidruntime(645): @ android.os.handler.dispatchmessage(handler.java:99) 06-24 13:30:22.848: e/androidruntime(645): @ android.os.looper.loop(looper.java:126) 06-24 13:30:22.848: e/androidruntime(645): @ android.app.activitythread.main(activitythread.java:3997) 06-24 13:30:22.848: e/androidruntime(645): @ java.lang.reflect.method.invokenative(native method) 06-24 13:30:22.848: e/androidruntime(645): @ java.lang.reflect.method.invoke(method.java:491) 06-24 13:30:22.848: e/androidruntime(645): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:841) 06-24 13:30:22.848: e/androidruntime(645): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:599) 06-24 13:30:22.848: e/androidruntime(645): @ dalvik.system.nativestart.main(native method) 06-24 13:30:22.848: e/androidruntime(645): caused by: java.lang.nullpointerexception 06-24 13:30:22.848: e/androidruntime(645): @ nebeek.literary.babataher.mainactivity.oncreate(mainactivity.java:34) 06-24 13:30:22.848: e/androidruntime(645): @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1048) 06-24 13:30:22.848: e/androidruntime(645): @ android.app.activitythread.performlaunchactivity(activitythread.java:1700) 06-24 13:30:22.848: e/androidruntime(645): ... 11 more

my main activity folllow:

package nebeek.literary.babataher; import nebeek.literary.babataher.r; import nebeek.literary.babataher.setting.hemistichfont; import nebeek.literary.babataher.setting.indexfont; import nebeek.literary.babataher.setting.webviewactivity; import android.annotation.suppresslint; import android.app.actionbar; import android.app.actionbar.layoutparams; import android.content.intent; import android.os.bundle; import android.support.v4.app.fragmentactivity; import android.support.v4.app.fragmenttransaction; import android.view.menuinflater; import android.view.menuitem; import android.view.view; import android.widget.popupmenu; import android.widget.textview; @suppresslint({ "newapi", "servicecast" }) public class mainactivity extends fragmentactivity implements indexfragment.onindexselectedlistener { textview title; private final static string message_to_setting = null; private static final string home_page = null; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); actionbar actionbar = getactionbar(); actionbar.setdisplayoptions(actionbar.display_show_custom); view actionbarview = getlayoutinflater().inflate(r.layout.actionbar, null); actionbar.layoutparams params = new actionbar.layoutparams( layoutparams.match_parent, layoutparams.match_parent); actionbar.setcustomview(actionbarview, params); actionbar.seticon(android.r.color.transparent); actionbar.setlogo(android.r.color.transparent); title = (textview) findviewbyid(r.id.title); title.settext("دیوان اشعار باباطاهر"); setcontentview(r.layout.activity_main); if (findviewbyid(r.id.fragment_container) != null) { if (savedinstancestate != null) { return; } indexfragment firstfragment = new indexfragment(); firstfragment.setarguments(getintent().getextras()); getsupportfragmentmanager().begintransaction() .add(r.id.fragment_container, firstfragment).commit(); } } @override public void onpoemtypeselected(string id, string poemtype) { poemtypefragment poemtypefrag = (poemtypefragment) getsupportfragmentmanager() .findfragmentbyid(r.id.type_fragment); if (poemtypefrag != null) { title.settext(poemtype); poemtypefrag.updatepoemtypeview(id, poemtype); } else { string[] value = { id, poemtype }; title.settext(poemtype); poemtypefragment newfragment = new poemtypefragment(); bundle args = new bundle(); args.putstringarray(poemtypefragment.value, value); newfragment.setarguments(args); fragmenttransaction transaction = getsupportfragmentmanager() .begintransaction(); transaction.replace(r.id.fragment_container, newfragment); transaction.addtobackstack(null); transaction.commit(); } } public void showfontsetting(final view view) { popupmenu popup = new popupmenu(this, view); menuinflater inflater = popup.getmenuinflater(); inflater.inflate(r.menu.menu, popup.getmenu()); popup.show(); popup.setonmenuitemclicklistener(new popupmenu.onmenuitemclicklistener() { @override public boolean onmenuitemclick(menuitem item) { string message = "index"; switch (item.getitemid()) { case r.id.item1: intent intent = new intent(view.getcontext(), indexfont.class); intent.putextra(message_to_setting, message); startactivity(intent); break; case r.id.item2: intent intent2 = new intent(view.getcontext(), hemistichfont.class); intent2.putextra(message_to_setting, message); startactivity(intent2); break; case r.id.item3: intent intent3 = new intent(view.getcontext(), webviewactivity.class); string address = "http://nebeek.com/default/page?view=about"; intent3.putextra(getextramessage(), address); startactivity(intent3); break; } homecoming true; } }); } public static string getextramessage() { homecoming home_page; } public void showhomepage(view view) { intent intent = new intent(view.getcontext(), webviewactivity.class); string address = "http://nebeek.com/documents"; intent.putextra(getextramessage(), address); startactivity(intent); } }

i checked every things used supported in api 11 too. don't understand why error?

android android-fragments popup android-actionbar

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -