ShareActionProvider is not working accurately with support library in android -


i stuck on hectic bug , couldn't fix after checking related questions here. have app in using sharactionprovider in action bar sharing content support of appcompat library. here related code: in activity:

@override     public boolean oncreateoptionsmenu(menu menu) {         // inflate menu items use in action bar         menuinflater inflater = getmenuinflater();         inflater.inflate(r.menu.cafe__detail, menu);         menuitem item = menu.finditem(r.id.share);         mshareactionprovider =  (shareactionprovider) menuitemcompat.getactionprovider(item);              mshareactionprovider.setshareintent(getdefaultintent());         return super.oncreateoptionsmenu(menu);     }      private intent getdefaultintent() {         intent intent = new intent();         intent.setaction(intent.action_send);         intent.putextra(intent.extra_text, "testing text");         intent.settype("text/plain");                return intent;     } 

here imports.

import android.support.v4.app.fragmentmanager; import android.support.v4.view.menuitemcompat; import android.support.v4.view.viewpager; import android.support.v7.app.actionbar; import android.support.v7.app.actionbaractivity; import android.support.v7.widget.shareactionprovider; 

i extending activity actionbaractivity. here xml in manu.

<menu xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:app="http://schemas.android.com/apk/res-auto"     xmlns:tools="http://schemas.android.com/tools"     xmlns:myapp="http://schemas.android.com/apk/res-auto"     tools:context="com.myapp.cafe_detail" >        <item android:id="@+id/share"           android:title="@string/action_share"           android:icon="@drawable/abc_ic_menu_share_holo_dark"           myapp:showasaction="ifroom"           myapp:actionproviderclass="android.support.v7.widget.shareactionprovider" />     </menu> 

now is,when click on share button list of available applications shows when click 1 of them, app crashes. , null point exceptions throws. log cat shows this

05-14 18:30:01.942: e/androidruntime(4818): fatal exception: main 05-14 18:30:01.942: e/androidruntime(4818): java.lang.nullpointerexception 05-14 18:30:01.942: e/androidruntime(4818):     @ android.support.v7.internal.widget.activitychooserview.updateappearance(activitychooserview.java:510) 05-14 18:30:01.942: e/androidruntime(4818):     @ android.support.v7.internal.widget.activitychooserview.access$400(activitychooserview.java:66) 05-14 18:30:01.942: e/androidruntime(4818):     @ android.support.v7.internal.widget.activitychooserview$3.onchanged(activitychooserview.java:247) 05-14 18:30:01.942: e/androidruntime(4818):     @ android.database.datasetobservable.notifychanged(datasetobservable.java:37) 05-14 18:30:01.942: e/androidruntime(4818):     @ android.widget.baseadapter.notifydatasetchanged(baseadapter.java:50) 05-14 18:30:01.942: e/androidruntime(4818):     @ android.support.v7.internal.widget.activitychooserview$1.onchanged(activitychooserview.java:127) 05-14 18:30:01.942: e/androidruntime(4818):     @ android.database.datasetobservable.notifychanged(datasetobservable.java:37) 05-14 18:30:01.942: e/androidruntime(4818):     @ android.support.v7.internal.widget.activitychoosermodel.addhisoricalrecord(activitychoosermodel.java:749) 05-14 18:30:01.942: e/androidruntime(4818):     @ android.support.v7.internal.widget.activitychoosermodel.chooseactivity(activitychoosermodel.java:488) 05-14 18:30:01.942: e/androidruntime(4818):     @ android.support.v7.internal.widget.activitychooserview$callbacks.onitemclick(activitychooserview.java:553) 05-14 18:30:01.942: e/androidruntime(4818):     @ android.widget.adapterview.performitemclick(adapterview.java:298) 05-14 18:30:01.942: e/androidruntime(4818):     @ android.widget.abslistview.performitemclick(abslistview.java:1086) 05-14 18:30:01.942: e/androidruntime(4818):     @ android.widget.abslistview$performclick.run(abslistview.java:2855) 05-14 18:30:01.942: e/androidruntime(4818):     @ android.widget.abslistview$1.run(abslistview.java:3529) 05-14 18:30:01.942: e/androidruntime(4818):     @ android.os.handler.handlecallback(handler.java:615) 05-14 18:30:01.942: e/androidruntime(4818):     @ android.os.handler.dispatchmessage(handler.java:92) 05-14 18:30:01.942: e/androidruntime(4818):     @ android.os.looper.loop(looper.java:137) 05-14 18:30:01.942: e/androidruntime(4818):     @ android.app.activitythread.main(activitythread.java:4745) 05-14 18:30:01.942: e/androidruntime(4818):     @ java.lang.reflect.method.invokenative(native method) 05-14 18:30:01.942: e/androidruntime(4818):     @ java.lang.reflect.method.invoke(method.java:511) 05-14 18:30:01.942: e/androidruntime(4818):     @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:786) 05-14 18:30:01.942: e/androidruntime(4818):     @ com.android.internal.os.zygoteinit.main(zygoteinit.java:553) 05-14 18:30:01.942: e/androidruntime(4818):     @ dalvik.system.nativestart.main(native method) 

after crashing once, not opens activity, , throws same exception. please me?


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -