android - ShareActionProvider with one icon - looking as simple actionitem -



android - ShareActionProvider with one icon - looking as simple actionitem -

i want dislay shareactionprovider on actionbar, custom look&feel. 1 simple share icon without borders , without used app icon on right. providing popup menu used applications. there simple way without implementing own shareactionprovider?

ok regardless of actionbarsherlock first test see if creating intent correctly, abs uses same code generic chooser see if app's looking show when execute code.

intent i= new intent(intent.action_send); i.settype("text/plain"); i.putextra(android.content.intent.extra_text, "my test text"); startactivity(intent.createchooser(i,"share using ..."));

all of app's handle plain text show up, if facebook, or whatever expecting not there app's don't back upwards action_send intent type have registered (plain/text). (facebook does, more in minute)

abs has sample using share action provider try's send photo, not text message (status update) setup should using this

@override public boolean oncreateoptionsmenu(menu menu) { // inflate menu. getsupportmenuinflater().inflate(r.menu.share_action_provider, menu); // set file share history provider , set share intent. menuitem item = menu.finditem(r.id.menu_item_share_action_provider_action_bar); shareactionprovider provider = (shareactionprovider) item.getactionprovider(); provider.setsharehistoryfilename(shareactionprovider.default_share_history_file_name); // note can set/change intent time, // when user has selected image. provider.setshareintent(createshareintent()); homecoming true }

and here intent used match app's , list them out sample

private intent createshareintent() { intent shareintent = new intent(intent.action_send); shareintent.settype("image/plain"); uri uri = uri.fromfile(getfilestreampath("shared.png")); shareintent.putextra(intent.extra_stream, uri); shareintent.putextra(intent.extra_title, "this android icon"); homecoming shareintent; }

but want be

private intent createshareintent() { intent i= new intent(intent.action_send); i.settype("text/plain"); i.putextra(android.content.intent.extra_subject, "test - disregard"); i.putextra(android.content.intent.extra_text, uri.parse("http://noplace.com")); }

this should give same list in abs @ did in little test stub showed chooser above.

android android-actionbar shareactionprovider

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -