Add a custom action in ShareActionProvider menu - android

Putting a ShareActioProvider in an action bar and setting an intent on it is an easy way to share content on Android.
I would like to add my own action (e.g. "Add Bookmark", "Save for Later" etc) in the drop down menu that appears on screen when you tap on the share menu item. Is this possible?
I thought about creating an intent filter to capture the share intent within the app but I don't know if this would be the correct approach.

The ShareActionProvider should deal exclusively with share actions. Android provides ways for adding other custom actions (buttons) on the ActionBar.
The example provided on the official docs shows how to add a 'search' button. Thus, you can add your bookmark/save buttons alongside the share action provider one.
Additional actions can be moved to a spill-over button if there's too many of them to fit in the action bar.

Related

Alternative to using multiple FloatingActionButtons?

Right now I am using three FloatingActionButtons to represent add, save, and reset operations. However according to Material Design guidelines, you shouldn't use more than one such button: https://material.google.com/components/buttons-floating-action-button.html
What is the accepted practice? Is there another sort of bar that is better for holding onto multiple functionality buttons?
I would suggest using a single action button that transforms into related actions, i.e., add, save and reset.
So you'll have something like this after the floating action button was pressed:
If you choose to do this you might want to check out this:
Morph floating action button into related actions
Another option could be transforming the floating action button into a toolbar like this:
In that case you will want to check this out:
Floating Action Button expansion

open action bar overflow menu programatically in Android app

I need to open android support library action bar overflow menu (the one shown with three vertical dots) programatically. I know its a silly requirement but one of my client is insisting that they want the menu option to be opened and visible when user tap on a button in an activity.
Any pointer on how to do this will be highly appreciated.
Try using openOptionsMenu in your Activity.
You can do something similar to this implementing your own custom ActionProvider Check this out, in the "Creating a custom action provider" section.
Hope it helps

how to remove greendroid's homebutton

I'm using greendroid as a library in order to implement an action bar. I have a problem about how to remove the home button and customize the location of buttons.For example, I want to place the Add button first.
http://www.freeimagehosting.net/8kgbp1
In the picture above, I plan to arrange the Compose button to be displayed first, but I have problems on how to do it. Anyone know how to arrange the order of greendroid's action bar?

Use share button (like in ICS gallary) instead of share dialoge (Intent.ACTION_SEND)

I am trying to find a way to impelement a share button into my app (same like the one in the standard ICS gallary app, see picture link).
http://betanews.com/2011/10/19/get-acquainted-with-the-newest-android-ice-cream-sandwich-slideshow/#11
Intent.ACTION_SEND only opens a dialoge to the select the sharing options.
Android Share Via Dialog
This works fine, but from design side, I find this drop down list to select a app much more convenient.
Yet I cant figure out how to?
Does anybody have a good Idea how this button could be coded?
That is implemented using a ListPopupWindow, which at the moment is only available on Android 4.0.
This is implemented using ShareActionProvider available in SDK14+.
ActionProvider class replaces an action item with a customized layout,
but it also takes control of all the item's behaviors. When you
declare an action provider for a menu item in the action bar, it not
only controls the appearance of the item in the action bar with a
custom layout, but also handles the default event for the menu item
when it appears in the overflow menu
Its quiet easy to implement, you can follow the official documentation here.

How to create a custom Pulldown in the Honeycomb ActionBar?

I would like to add a custom pulldown menu to the actionbar in my project similar to the one that can be found in the google books app (screen).
In this case it represents the complete table of contents of the book.
I tried to follow the guide from the developer site where there is an example with a SpinnerAdapter. But when i use a custom Layout (in my case a RelativeLayout with two TextViews in it) i get an Exception that saying "ArrayAdapter requires the resource ID to be a TextView". So i dismissed my idea with the pulldown but then i found the pulldown in the books app wich looks to me like they used a custom layout as well because it looks to me like two single TextViews in one Layout.
Could anybody please enlighten me if what i want to do is even possible and how?
To me, that looks like the options menu -- that's where options menu items not promoted to the action bar itself appear. Use onCreateOptionsMenu() and add whatever items you want to the Menu.
EDIT:
Sorry, the screenshot was a bit confusing. There are two possibilities that I can see:
This could be a submenu for that action bar item -- I haven't played with submenus and the action bar yet (though this reminds me that I need to do that...)
This could be a PopupMenu tied to a custom action bar View

Categories

Resources