I am using a menu to use two buttons on AppCompat ActionBar, like the SearchView sample, The class used in this exact manner, but it is giving me this error:
02-18 11: 52: 06.644: E / Android Random (15 9 88): Death Redemption: the main 02-18 11:52: 06,644: e / AndroidRuntime (15,988): java.lang.NullPointerException 02-18 NOVEMBER: 52: 06,644 e / AndroidRuntime (15,988): .activities.ActivityFollowings.onCreateOptionsMenu (ActivityFollowings.java:133) 02-18 November: 52: 06.644: E / AndroidRuntime (15,988): android.app.Activity.onCreatePanelMenu (Activity.java:2538) 02-18 November: 52: 06.644: E / AndroidRuntime (15,988): .impl.PhoneWindow at com.android.internal.policy 02-18 on preparePanel (PhoneWindow.java:436) 02-18 NOVEMBER: 52: 06,644 e / AndroidRuntime (15,988): com.android.internal.policy.impl.PhoneWindow.doInvalidatePanelMenu (PhoneWindow.java:800) 11: 52: 06.644: E / Android Random (15 9 88): at com.android.internal.policy.impl Phone Wondo $ 1.run (PhoneWindow.javamore21) 02-18 11:52: 06.644: E / AndroidRuntime (15,988): android.view.Choreographer $ CallbackRecord.run (Choreographer.java:761) on 02- 18 11:52: 06.644: E / AndroidRuntime (15,988): android.view.Choreographer.doCallbacks (Choreographer.javaTT74) 02-18 November: 52: 06.644: E / AndroidRuntime (15,988): android .view.Choreographer.doFrame (Choreographer Java: 543) 02-18 11:52: 06.644: E / AndroidRuntime (15,988): 52: 06.644: E / AndroidRuntime android.view.Choreographer $ FrameDisplayEventReceiver.run ( Choreographer.java:747) 02-18 November (15,988): android.os.Handler.handleCallback (Handler.java:733) 02-18 November: 52: 06.644: E / AndroidRuntime (15,988): android. Os.Handler.dispatchMessage (Handler.java:95) on 02-18 November: 52: 06.644 : E / AndroidRuntime (15,988): 52: 06.644: E / AndroidRuntime (15,988): android.os.Looper.loop (Looper.java:136) on Android in 02-18 November. App.ActivityThread.main (ActivityThread.java ** 017) 02-18 11:52: 06.644: E / Android Time (1589): java.lang.reflect.Method.invokeNative (Basic Method) 02-18 11: 52: 06.644: E / Android Random (15 9 88): at java.lang.reflect.Method.invoke (Method.Java T15) 02-18 11:52: 06.644: E / Android Rettman (15,988): com. android.internal.os.ZygoteInit $ MethodAndArgsCaller.run (ZygoteInit.java:779) in November 2 to 18: 52: 06,644 e / AndroidRuntime (15,988): main (ZygoteInit on com.android.internal.os.ZygoteInit .java: 595) 02-18 11:52: 06.644: E / AndroidRuntime (15,988): dalvik.system.NativeStart.main (Native Method)
Here's my Menu xml:
& lt; Menu xmlns: Android = "http://schemas.android.com/apk/res/android" xmlns: app = "http://schemas.android .com / apk / res-auto" & gt; Android: icon = "@ drawable / Aisi_akshn_sserch" app: Action View class = "Android. Videtkbtn" app: Soasakshn = "Android: Adiakshn =" Android: ADA = "@ + id / Menu_btn_foltr" always "/ & gt; & LT; before android: id = "@ + id / menu_button_following" android: title = "@ string / action_search" android: icon = "@ drawable / ic_action_search" app: actionViewClass = "android.widget.Button" app: showAsAction = "Always" />
and where I am trying to use it A :.
@Override public boolean OnCreateOptionsMenu (Menu) {getMenuInflater () increase (R .menu.menu_switch, menu); Menuaitim following = menu.findItem (R.id.menu_button_following) ; BtnFollowing = (button) MenuItemCompat.getActionView (following); menu item followers = menu.finditum (Rd menu_buttons_falter); BtnFollowers = (button) MenuItemCompat.getActionView (followers); btnFollowing.setText (.getResources () GetString (R) .string.txt_header_seguindo)); BtnFollowers.setText (.getResources () GetString (R.string.txt_header_seguidores)); BtnFollowing.setOnClickListener (New OnClickListener () {@Override Click Public Zero (see V) {// onClick Action}}); Click on BtnFollowers.setOnClickListener (New OnClickListener) {@Override Public Zero (see V) {// onClick Action}}); Back true; }
Why is this happening?
Comments
Post a Comment