I am making an Android app. I have a list of items displaying. I am looking to create a popup menu just like the one that pops up when you tap the avatar of a contact in the contact list. I have tried looking through the Android reference but can not find it.
Has anyone created one of these popup menus? A link to the reference or a code sample is fine.
Screenshot of menu:
http://www.youchoob.org/pics/popup.jpg
What you are describing is called a 'Quick Action'. This is actually a user interface pattern - there isn't an existing widget or anything in the API for this. They discussed it at Google IO (See in this video here, at the 15:40 mark), and also there has been some discussion on how to implement it on stack overflow, specifically this question. If you start digging around (now that you know the name of what you are looking for) you might find more.
you can find "QuickAction" widget in
https://github.com/cyrilmottier/GreenDroid
below is a demo activity
https://github.com/cyrilmottier/GreenDroid/blob/master/GDCatalog/src/com/cyrilmottier/android/gdcatalog/QuickActionActivity.java
Please find the code OR framework from here :
http://www.londatiga.net/it/how-to-create-quickaction-dialog-in-android/
The source code for the contacts is open source. You should look around here and see if you can find it.
https://android.googlesource.com/platform/packages/apps/Contacts
I'm looking now if I find it I will edit.
Related
Basically, I'm trying to create the app shortcuts UI available in an android app.
I'll like to be able to have a similar popup when tapping the android basic activity (+) button, but the closest thing I've found is the ContextMenu.
I'm not certain if it's a context menu with styling or how to approach it. Any help would be appreciated.
I've had a good look around but could not find an answer.
Thanks!
Edit: To clarify since this was marked as a duplicate. I am not trying to create launcher shortcuts. I am trying to create a component that looks like launcher shortcuts in the app. For example if a Floating Action Button was pressed.
This launcher is part of AOSP and You're free to read thru the ArrowPopup.java source code.
It might take a bit of digging to find and extract referenced resources, but that's what it is.
I've looked at the documentation and the example but it only shows ways to add/remove menu items, but not disable. Is it not possible or is there a way to do this? If so, can you please provide me a link to the full API(if there is one).
Did you try watching this addon source code? Sometimes some thing are the same in mobile: https://addons.mozilla.org/en-US/firefox/addon/menu-editor/
There is a lot of people who can help you here:
http://client01.chat.mibbit.com/?server=irc.mozilla.org&channel=%23mobile
You can use NativeWindow.menu.add(...) to add the menu, then use NativeWindow.menu.update(...) to disable it. See the docs for examples:
https://developer.mozilla.org/en-US/docs/Extensions/Mobile/API/NativeWindow/menu/update
I've implemented a ContentProvider to add custom suggestions to my applications Quick Search Box. It works great within my app. However I also included it into the global search and it works different there. Whenever I start a search in the global search and I select one of my suggestions, this suggestion is saved and presented the next time I open the global search. What I don't like is that my current suggestions are below the ones I clicked before.
Is there a way to disable this behavior?
I am currently thinking of integrating recent suggestions in my ContentProvider to provide both - recent and custom suggestions. Though I am afraid this will result in having the same suggestions twice - first from the global search and then from my ContentProvider...
Any advice?
I think you could try to create a custom SearchRecentSuggestionsProvider as described here.
From in there, simply return an empty cursor or null.
To answer my own question, it is possible by providing the SUGGEST_NEVER_MAKE_SHORTCUT value in the SUGGEST_COLUMN_SHORTCUT_ID column.
As usual this is described in the Android developer documentation here.
I want to add Pattern 6: QuickActions from android's blog to my app.
Any code snippet?
Anyone try to do it already?
Should this work on android 1.5?
I just found this question right after I posted my own question/answer. Here's the code I developed for this. http://code.google.com/p/simple-quickactions/
I also have been searching for this and found someone through the wave of the Google IO session who has implemented such thing.
He posted the code on GitHub. I just tested it, and it works just great!
You'll also need some ressources from the project (drawables, styles..).
Look at line 1310 of ContactsListActivity.java from the Contacts application. It's the code that creates the intent for the contact shortcuts on the home screen that launch the quick actions intent for a contact.
This won't work before eclair.
Until the official Twitter app is open sourced by Google, you may want to take a look at this implementation:
It's really easy to use and works great.
That app is going to be open sourced at some point so you may want to wait until then. But it could be done with a Dialog with a custom background drawable, and using Window.LayoutParams to position the dialog.
i asked so many question regarding my title but i could not get my proper answer till yet.I need to implement androd's menu feature in my application ie when we goes to gallery in android phone, when we press menu than it comes with lots of option like share...etc.My question is can i implement same menu feature in my application? It is possible or not?
Thanks
To implement a "Share" feature, all you need to do is use createChooser() and an ACTION_SEND Intent.
Here is a blog post covering the technique.
If I am understanding your question you want to know if you can duplicate the feature of tapping on the menu button on the phone and having it pull up an options menu that you can then share via, gmail or some other posting medium?
If this is correct then I would have to say I would assume that you could duplicate this feature.
In short YES!
If you are wondering how you are to do this then I would start at here http://developer.android.com/guide/topics/ui/menus.html
Droidnova .com (I posted it like this because as a new user I can only post one link) also has a good little how to on menu's.
I would also like to add that this is my first time posting on stackoverflow so please let me know if this was a good post or what I should do next time.
Thanks,
Bactos