android - actionbar dropdown not working when in fragment -
i have navigation menu bar , drop-down in action bar.the ui looks this:
for navigation different ui i’m using fragments.when click on top of drop-down should list out added items instead im getting exception:
06-04 18:12:39.651 22359-22359/com.poliveira.apps.materialtests w/dalvikvm﹕ method landroid/support/v7/internal/widget/listviewcompat;.lookforselectableposition incorrectly overrides package-private method same name in landroid/widget/listview; 06-04 18:12:39.671 22359-22359/com.poliveira.apps.materialtests d/androidruntime﹕ shutting down vm 06-04 18:12:39.671 22359-22359/com.poliveira.apps.materialtests w/dalvikvm﹕ threadid=1: thread exiting uncaught exception (group=0x40ce5930) 06-04 18:12:39.671 22359-22359/com.poliveira.apps.materialtests e/androidruntime﹕ fatal exception: main java.lang.nullpointerexception @ android.widget.relativelayout.onmeasure(relativelayout.java:529) @ android.view.view.measure(view.java:15535) @ android.support.v7.internal.widget.listviewcompat.measureheightofchildrencompat(listviewcompat.java:294) @ android.support.v7.widget.listpopupwindow.builddropdown(listpopupwindow.java:1200) @ android.support.v7.widget.listpopupwindow.show(listpopupwindow.java:584) @ android.support.v7.internal.widget.spinnercompat.performclick(spinnercompat.java:603) @ android.view.view$performclick.run(view.java:17372) @ android.os.handler.handlecallback(handler.java:725) @ android.os.handler.dispatchmessage(handler.java:92) @ android.os.looper.loop(looper.java:137) @ android.app.activitythread.main(activitythread.java:5041) @ java.lang.reflect.method.invokenative(native method) @ java.lang.reflect.method.invoke(method.java:511) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:793) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:560) @ dalvik.system.nativestart.main(native method)
in mainactivity.java on-create i’m doing this:
mtoolbar = (toolbar) findviewbyid(r.id.toolbar_actionbar); setsupportactionbar(mtoolbar); getsupportactionbar().setdisplayshowhomeenabled(true); actionbar=getsupportactionbar(); actionbar.setdisplayshowtitleenabled(false); // enabling spinner dropdown navigation actionbar.setnavigationmode(actionbar.navigation_mode_list); actionbar.setdisplayshowhomeenabled(true); // spinner title navigation data navspinner = new arraylist<spinnernavitem>(); navspinner.add(new spinnernavitem("local", r.drawable.deviceonline)); navspinner.add(new spinnernavitem("my places", r.drawable.deviceonline)); navspinner.add(new spinnernavitem("checkins", r.drawable.deviceonline)); navspinner.add(new spinnernavitem("latitude", r.drawable.deviceonline)); // title drop down adapter adapter = new titlenavigationadapter(getapplicationcontext(), navspinner); // assigning spinner navigation actionbar.setlistnavigationcallbacks(adapter, this);
i’m having fragment class called "refragment.java". code i'm using:
@override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view rootview; display d =getactivity().getwindowmanager().getdefaultdisplay(); // set display size thumbsize.setscreensize(d.getwidth(), d.getheight()); final int w = d.getwidth(); final int h = d.getheight(); final double ar = w > h ? (double) w / (double) h : (double) h / (double) w; if (ar > 1.6) { log.i(tag, "ar = " + ar + ", using extended layout."); rootview= inflater.inflate(r.layout.rbox_extended, container, false); } else { log.i(tag, "ar = " + ar + ", normal layout."); rootview= inflater.inflate(r.layout.rbox, container, false); } if (mviewflipper != null) { mremoteview = mviewflipper.getchildat(0); mmousepadview = mviewflipper.getchildat(1); mgestureview = mviewflipper.getchildat(2); mviewflipper.setdisplayedchild(0); // mremoteview } rootview.findviewbyid(android.r.id.content); mremotecontroller = new remotecontroller(getactivity().getapplicationcontext()); mconfigurationmanager = configurationmanager.getinstance(getactivity()); setupbuttons(rootview); setupslider(ar,rootview,mmainactivitiycontext); return rootview; }
Comments
Post a Comment