shareactionprovider - Android - share button not responding -
i have intent
button share = (button)findviewbyid(r.id.share); share.setonclicklistener(new button.onclicklistener() { public void onclick(view v) { //createshareintent( ); } });
and these 2 methods in class:
@override public boolean oncreateoptionsmenu(menu menu) { getmenuinflater().inflate(r.layout.menu, menu); menuitem item = menu.finditem(r.id.menu_item_share); myshareactionprovider = (shareactionprovider)item.getactionprovider(); myshareactionprovider.setsharehistoryfilename( shareactionprovider.default_share_history_file_name); myshareactionprovider.setshareintent(createshareintent()); return true; } private intent createshareintent() { intent shareintent = new intent(intent.action_send); shareintent.settype("text/plain"); shareintent.putextra(intent.extra_text, "testing"); return shareintent; } public void doshare(intent shareintent) { // when want share set share intent. myshareactionprovider.setshareintent(shareintent); }
and sdk version configuration:
<uses-sdk android:minsdkversion="4" android:targetsdkversion="15"/>
but problm not know how call this. how menu show after share button clicked?
thanks!
you can open option menu code calling openoptionsmenu()
method. doc here does-
programmatically opens options menu. if options menu open, method nothing.
but question why doing so. have hardware menu button open option menu. better leave so. if want show user option button click use dialog. why option menu?
Comments
Post a Comment