[Update 15/07/2011]
I have updated the quickaction implementation code so it can be used more efficient and the dialog will be automatically dismissed after pressing the action item. All the source codes now available via github so you can track the changes.
Official Twitter application for Android has introduced new Android UI features and behavior patterns such as Dashboard, Search Bar, QuickAction and Action Bar. One of the interesting pattern is QuickActions that displays contextual actions in a list view. This pattern actually already exists in QuickContact dialog/bar in default Contact application (since Android 2.0).
The QuickActions dialog is not included in standard Android SDK, so we have to create it manually. At first, i had no idea on how to create it so i decided to download and read the Contact app source code from Android git. I found that the QuickContact dialog uses private API call (com.android.internal.policy.PolicyManager) that does not exists in standard SDK. After posting question about it on google groups and stack overflow, i got the solution for it from Qberticus (thanx Qberticus!).
Qberticus’s QuickActions uses simple/plain layout so i have to create a custom layout so it will look like QuickContact in Contact app or QuickActions in Twitter app. Based on QuickContact source code, i made a slight modification on Qberticus’s BetterPopupWindow class and extended it to implement custom layout. I also made it customizeable, so the icon and text in action list can be customized.
Here are the screenshoots of QuickActions demo:
QuickContact / Twitter-like QuickActions
Code snippet
Create action items
<br />//Add action item<br />ActionItem addAction = new ActionItem();<br /><br />addAction.setTitle("Add");<br />addAction.setIcon(getResources().getDrawable(R.drawable.ic_add));<br /><br />//Accept action item<br />ActionItem accAction = new ActionItem();<br /><br />accAction.setTitle("Accept");<br />accAction.setIcon(getResources().getDrawable(R.drawable.ic_accept));<br /><br />//Upload action item<br />ActionItem upAction = new ActionItem();<br /><br />upAction.setTitle("Upload");<br />upAction.setIcon(getResources().getDrawable(R.drawable.ic_up));<br />Line 02: Create new action item
Line 04: Set action title
Line 05: Set action iconCreate quickaction instance and setup listener
<br />final QuickAction mQuickAction = new QuickAction(this);<br /><br />mQuickAction.addActionItem(addAction);<br />mQuickAction.addActionItem(accAction);<br />mQuickAction.addActionItem(upAction);<br /><br />//setup the action item click listener<br />mQuickAction.setOnActionItemClickListener(new QuickAction.OnActionItemClickListener() {<br /><%%KEEPWHITESPACE%%> @Override<br /><%%KEEPWHITESPACE%%> public void onItemClick(int pos) {<br /><%%KEEPWHITESPACE%%> if (pos == 0) { //Add item selected<br /><%%KEEPWHITESPACE%%> Toast.makeText(Example1Activity.this, "Add item selected", Toast.LENGTH_SHORT).show();<br /><%%KEEPWHITESPACE%%> } else if (pos == 1) { //Accept item selected<br /><%%KEEPWHITESPACE%%> Toast.makeText(Example1Activity.this, "Accept item selected", Toast.LENGTH_SHORT).show();<br /><%%KEEPWHITESPACE%%> } else if (pos == 2) { //Upload item selected<br /><%%KEEPWHITESPACE%%> Toast.makeText(Example1Activity.this, "Upload items selected", Toast.LENGTH_SHORT).show();<br /><%%KEEPWHITESPACE%%> }<br /><%%KEEPWHITESPACE%%> }<br />});<br />Line 1: Create quickaction instance
Line 3-5: Add the action items into quikaction
Line 8: Setup listener for action item clicked, the pos argument on onItemClick method shows which action item is clicked.Show quickAction dialog
<br />btn1.setOnClickListener(new View.OnClickListener() {<br />@Override<br />public void onClick(View v) {<br /><%%KEEPWHITESPACE%%> mQuickAction.show(v);<br />}<br />});<br />[ad]
Line 04: Show quickaction dialog, the v argument used as the anchor where the quickaction displayed.
Gallery3D-like QuickActions
![]()
Implementation on My Application
BlitzDroid
![]()
Minapolitan (Prototype)
![]()
Buy me a coffee
If you found this stuff useful to your work, please consider a donation.
By doing this you will be helping me to keep improving this stuff and to continue to help anyone who needs, and maybe keep on helping you in the future.
Thanks for your support, will do my best to keep the info fresh and useful.







this is a god send!
This is huge man. I’ve been searching for Tweeter app source code all time since it was published just to find out how this QuickActions bar works.
Thank you very much.
Thank you, I was searching for this a long time ago.
Thank you.
I modified a bit your code (i did it first with Qberticus.
Replacing in CustomPopupWindow
this :
if (rootHeight > anchorHeight) {
by :
if (rootHeight > anchor.getTop() {
Cause in Listview, i managed to have Quickactionbar over my title bar, not so nice. With getTop, no problem anymore.
Okay thanx Akex for the correction 🙂
Shared your page with some other french devs. Lot of thanks for you 🙂 and Qberticus
Okay & you’re welcome 🙂
Thanks for the code. I’m guessing the code is released under the same licence as the original code (new BSD licence)?
Thanks again. I’ll make sure to mention it at the MANGTUG meeting next week 🙂
You’re welcome & yes 😀
Perfect. Thank you 🙂
Hi Lorenz,
If i wanna like t olearn adnroid prgramming development and contribute, how it can be started. I have done and replciated exact tools steps which you have mentioned in your blog.
Now what are the resources where i can learn to program and develop android application.
Appreciate your time and support on your blog.
Thanks,
Hi 5xnewx,
Glad to hear you are interested in Android Programming. You can find android resources on android developers site http://developer.android.com/guide/index.html. Sample tutorials can be found here http://developer.android.com/resources/samples/get.html
Thanks a lot … !!!
I was stuck in my project without this ….
u r an angel 🙂 🙂 🙂
Thanks, can’t wait to try it out later. Did you look into the Action bar that’s also mentioned in the google I/O talk and in the Twitter app.
I am making my own Contact mgmt system & implemented the above code. i need 2 implement the further functionality now.. ie; to make a call after clicking on the “Call” Action Item.. I have the code to initiate a call from Android. But as you see in the Native Address Book, if you have 2-3 phone numbers saved for a contact, the QuickAction window grows down listing all the numbers saved & asks you to select one from the 2-3 phone numbers.. any idea how to implement this window …
Thanx in advance..
Hi Ash,
You can read the source code of Contacts app from android source tree, there is a method inside QuickContactWindow.java that implements it. Sorry i can’t give you the exact solution. 🙂
OMG YOU are awesome. I cant believe that 3 months later they still havent published the source code for this even though they say its “best practices”. Good on you man!
Thanx Clay, i couldn’t wait for their source code so it pushed me to read the Contact app source code :-(.
Hi, I’d like to make a few modifications to the above presented solution.
First of all, if I want to use icons which are larger than the once in the example, the action item area grows below the row of action items. I’ve tried modifying the padding and such to give the icon some more space, but it didn’t work.
Any ideas how to make the above example work with arbitrarly large icons? And/or with the text below the icon?
Hi Christoffer,
In order to use more bigger action icons, you must make a modification on quickaction’s icon, make a new bigger image for it’s rail background. Or try to use Twitter’s quickaction icon (extract its apk files and copy background image from drawable-mdpi/hdpi).
Hi. Your stuff is awesome!
But is it possible to dim the screen behind the PopupWindow, just like with the context menu?
Houses are expensive and not everybody is able to buy it. Nevertheless, personal loans are created to help different people in such hard situations.
Hi can I use the code in my application? Is there any thing else that I need to do regarding the license like referring you or something else to use this code?
Thank you for the code. Have been looking for this since a few days.
Yes you can, feel free to use it 🙂
Hi, I’d like to make for than 2 items in the QuickAction. How can I do this?
Thanks!
Create new ActionItem object then add it to QuickAction as described on example code above.
I have ever do that but it always only shows two of them…weird!
Sorry I was tired, I fix it…stupid error.
Thanks for this awesome stuff!
You’re welcome..:-)
Nice post, I will create this api. too in my mobile.
Nice post,
I hava a question, how to dismiss the quickaction when the activity don’t to change.
Hi Herbert, i’ll update this post & upload the new code including the dismis listener & implementation on listview..maybe 1-2 days ahead…
This is so cool! Great job, Lorenz. But when you use this component, you only target your application for Eclair and above? Do you know of any component that is similar to this for Cupcake and Donut? I’m not saying that it has to be exactly the same, but alike.
Helo Rui, yes currently my apps using this quickaction are for 2.1 and above. I don’t know similiar component on old cupcake & donut 🙂
I have modified your layout to present the label for the icon below the icon itself, much like the Twitter application. In order to do this, make the following changes to res/layout/action_item.xml:
LinearLayout:
android:orientation = “vertical”
android:paddingTop = “0dip”
android:paddingBottom = “0dip”
ImageView:
android:layout_height = “fill_parent”
android:paddingLeft = “5dip”
android:paddingRight = “5dip”
TextView:
android:layout_width = “wrap_content”
android:textSize = “10sp”
There is only one caveat to this that I can see: in order for the labels to all line up, the icons must be the same size. Since they _should_ be the same size to begin with, this isn’t much of a problem.
I hope that helps someone! Thank you so much for the code!
Tnx, very nice, tnx for this 🙂
@Michael, that is also a nice adjustment 🙂
That is sexy, thanks
hopefully I can fiddle with it some more 😉
Just noticed it’s 2.1 and above 🙁
I could code it to check the version and then fall back to an AlertDialog but whats the point in supporting two varieties 🙁
Have you tested it? Because I ran it in an 1.6 emulator and that worked..
This post is a winner! Love the tips and everything you suggest.. Thanks
Your tips are really great except the one suggesting to steal our competition articles haha . Nice tipps, thanks!
Thank you for taking the time to publish this information very useful!
Thank you! 😀
Awesome work buddy. This has helped me a lot.
You Sir, are my official hero of he week! This is simply great 🙂 I hope Google sees this and pulls it into the official Android API ASAP.
And thanks to Michael Herold as well, for his alternative layout making the text appear below the icons.
I’ll reiterate what everyone else on here as said so far. Thanks a ton to you and Qberticus for this work. I was just about to give up and try to work this myself when I finally stumbled upon your blog post. I’m hoping that Google will put something like this in the next release of the SDK, but until then, you’ve done a beautiful job with both samples. Thanks again!
Thanks really very helpfull
Great tutorial.
I am fairly new to Android and Java. I implemented this in my app, but I do not know how to make the Pop-up dismiss automatically when an option is selected.
Please help!!
I also like to know this.
To Mike and Calium,
I’ve updated this post and added new example that shows how to dismiss popup.
Checkout section “QuickActions With Dismiss on Action Selected”
Thank you so much, Lorenz!!
You are my star! 🙂
VERY good job man. It’s a shame that android doesn’t provide that by default.
Great job! Thanks for your work 🙂
I will try to testing in my UI enviroment
Trims dude
You’re welcome bro 😉
hi. this is just what I’m looking for. thx.
What is the best practice when dealing with PopupWindow class ?
Is it okay if I just create and create another instance everytime I want to show a popup ?
Can I reuse the same instance ? That is after I call dismiss, then I call showAtLocation again.
thx
Thanks man!
Lorenz,
Good work on the widget, saved a life here!
Quick question though, how do you implement Gallery3D-like QuickActions?
I’ve tried
mQuickAction.showDropDown(); with no luck,
mQuickAction.showLikeQuickAction(0,30); with no luck either.
Thanks.
awesome tutorial, thanks alot.
one question about it: is it possible to implement quick actions using this code as well on the application icon? much like the contacts placed on the home screen pop up a context menu to call, sms, emai, etc. how would you go about it?
Great job, love the look and feel of your quick action. I have found one problem while using a listadapter that has more than one size of views in the list. The quickaction window does not line up quite right like it does with a list of equal size views. Anyone have this problem or any solutions?
thanks, amazing bunch of code. really gives a nice look to the application!
I found a bug…
if (rootHeight > anchor.getTop()) {
…
should be
if (rootHeight > anchor.top) {
…
because anchor.getTop() will give the relative and not the absolute top.
Hi man! thanks so much for this, i made a slight change is the CustomPopupWindow class to make dissmissing a quickaction look much better, with this code it wont become see-through when pressed.
thanks once again!
public void dismiss() {
Handler mHandler = new Handler(); mHandler.postDelayed(mUpdateTimeTask,10);
}
Runnable mUpdateTimeTask = new Runnable(
{
public void run() {
window.dismiss();
}
};
Fantastic work! Exactly what I was looking for.
Lorenz, you are my hero! 🙂
Just to be absolutely sure: I can use parts of your sample code and the drawables in my own app? Of course I give big thanks to you in the About Dialog of my app, but you’re okay with that, right?
Hello Manuel,
Thank you, feel free to use it;)
Regards
So cool! 🙂
I will post a screenshot of how I use QuickAction in my app.
Hi Manuel, thanx.
Btw, i’m working on new updates for this quickaction. Fixing some bugs and the code is more efficient now. I’ll make an update to this post within next few days.
Regards
Great to hear. 🙂
At the moment I’m using the Gallery3D-like QuickAction. Will they be updated as well?
Great find for me. I’ve tried it and it works fine, although I’ll wait for your updates before implementing it into my own app.
Great work.
You are the man!!! Really great stuff.
Thanks a lot for sharing. Keep up the good work.
One more question though.
Really don’t want to come across as the unappreciative nitpicker here but how come that the borders and icons are not really sharp and clean – and more important do you or anybody else know how to improve the overall look of this *admittetly already really nice* feature?
Best wishes and king regards.
Bruiser
i want program on mapviews .in that mapview contains many overlayitems .if u tap on the icon it displays one windownc
This is really great, thanks for sharing!!
I’ve only one question, if I want to use Gallery 3D like actions and QuickActions together in my app, do I have to import both projects? (I would have to refactor, because it’s in the same package and the conflict will appear). Or is there any mysterious flag to show normal QA and gallery 3D like?
Thanks again
Great tutorial Lorenz!
One thing that occurs while I tested your implementation: If you click on an item in the quick action bar the item gets transparent (doesn’t show the orange/highlighted background). This doesn’t happen if you press the item as long as it takes for the orange/highlight background to appear. Any ideas on this?
Thanks for this great tutorial/code!
I have the same “issue”. Didn’t find a way to prevent this, yet, but I am interested in a solution, too.
Hi, the animation on popup dismiss causes that, you can disable exit animation to solve the problem.
Hi Lorenz,
thanks for your comment. I deleted the overridden dismiss()-Method in the CustomPopupWindow class which solves the problem. Is that want you meant with disable the exit animation?
Thanks again for this great tutorial!
Andy
Argh, well it doesn’t solve the problem. It just leads to not closing the bar…
Can you give me some more detailed information what I need to do? This would be much appreciated.
Thanks in advance
Andy
Hello, could you please specify under witch licence is id distributed?
Thank you 🙂
New BSD License 😉
New BSD License
>> How could be ? There is no sign of BSD License Information inside the code itself.
Can you explain a little ?
Thanks for the demos! But I found a small bug when using QuickAction class. After the QuickAction view dismisses, call QuickAction.show() again, it will re-add previous ActionItems in actionList again. After adding a flag to decide whether they have been added fix the bug.
It would be nice if there will be an ability to use custom layouts for quick actions. For example, I want to use only icons placed on 3×4 table layout.
I have created the quick action bar successfully. Now I want to open a context menu on clicking the buttons on quick action bar. How can I do this?
Done a Superb job buddy!!!
Please help me for creating a multi-row quick action bar
Great job man! Works perfectly…
Surely cut my development time
I think that:
if move”createActionList()” before “root.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));” . It well be better.
In your example code you set Anonymous Listeners for each ActionItem. If I change this so my class implements OnClickListener then I implement one onClick(View v) method and have it deal with all onClicks (second description here: http://tseng-blog.nge-web.net/blog/2009/02/14/implementing-listeners-in-your-android-java-application/), I have no way of determining which ActionItem caused it to execute since only the View (in this case a LinearLayout) is passed, not the ActionItem. How can I determine which ActionItem was clicked?
Thanks
Nice one mate, exactly what im looking for 🙂
Nice one, exactly what I’m looking for.
Hi, you have done a great job.
I have got a suggestion for Gallery3D-like QuickActions.
In class QuickAction and method show(), use anchor.getLocationInWindow(location) instead of anchor.getLocationOnScreen(location). It fixes yPos bug when Activity has Dialog theme. I hope it help someone…
Hi, thanx for sharing 😉
Grate. Thanks. I was looking for this. I’ll do some customization to use it in my app.
Hi! I’m kinda new to Android but I’m using your codes to my very simple app. Thank you very much for that!
I’ve very very few times to go through your codes. so can you please help me in reducing the height of the Quick Action Dialog?
Thanx man…really helpful…now i will be able to save a lot of screen space with such good looking interface…
Great job on this lorenz!
Just a quick pointer for the Gallery3D quick actions:
In action_item.xml change the icon ImageView layout_height to match_parent otherwise some of the quick actions don’t get enough height if their icon is small and/or you add top/bottom padding to the title.
Also if you don’t use an icon at all the quick action doesn’t display because it’s using the layout_height of the icon (not sure why it doesn’t go by the title height) so doing to above solves that too but better still add onto the icon null check the following so that it isn’t used in calculating the layout at all if it’s not used:
else {
img.setVisibility(View.GONE);
}
Keep up the good work!
Ok thanx for your correction ..
Hi Lorenz,
Great job!
I have used the BetterPopupwindow in my app.
But I get some force close, the log is from the user, I never reproduce it:
java.lang.NullPointerException
at android.widget.PopupWindow$PopupViewContainer.dispatchKeyEvent(PopupWindow.java:1359)
at android.view.ViewRoot.deliverKeyEventToViewHierarchy(ViewRoot.java:2496)
at android.view.ViewRoot.deliverKeyEvent(ViewRoot.java:2456)
at android.view.ViewRoot.handleMessage(ViewRoot.java:1766)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
at dalvik.system.NativeStart.main(Native Method)
Any idea?
Thank you.
hmm, sorry i have no idea ..
Hello Lorenz,
A big thanks for you. and can i use your sample code and the drawables in my app? my app is here : https://market.android.com/details?id=com.morgoo.launcher
Hi, yes you can use the codes and all the resources here..
Thanks for sharing this, very helpful!
I wanted some more info that I could use from ActionItem so I customized the callback. Here’s the addition.
/// some info so callback will have the action item to pass
private static class ListenInfo {
public ActionItem ai;
public View v;
public ListenInfo (View v, ActionItem ai) {
this.ai = ai;
this.v = v;
}
}
/// New Callback function
public static class OnClickListener {
public void onClick(View v, ActionItem ai) {
}
};
/// Internal view callback handler
private View.OnClickListener quickListener = new View.OnClickListener() {
public void onClick(View v) {
// retrieve action info from tag
ListenInfo li = (ListenInfo) v.getTag();
// call the callback
li.ai.listener.onClick(li.v, li.ai);
}
};
Then when adding an action add:
view.setTag(new ListenInfo(view,actionList.get(i)));
Cheers
Nice work Lorenz!!! 🙂
Big thx to share it. Very helpful. Can I use it for my own application?
Yes you can 😉
Nice work Lorenz 😀
I’m using your code in my academic android project, hopes you don’t mind 😉
Unbelievably helpful piece of code, and it works like it should. Easy and smooth – thumbs up from me!
Ok Jakub, feel free to use it. Hope it helps you. 😉
Bro,
you owe a hug from me. Very nice code and works like a charm . Thanks for sharing the code .
Tareq
You’re welcome 😉
Thanks for this.
I also ran into the problem where tapping a button to dismiss the bubble leaves behind a black rectangle. A lame (but functional) workaround is to call dismiss() after a short delay instead of calling it directly, like so:
public void onClick(View v) {
// Instead of calling dismiss() directly, do:
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
// Give the button time to draw its “pressed” state.
// Without this delay, the pressed button is transparent
// while the exit animation runs.
dw.dismiss();
}
}, 10);
}
This is fucking awesome man. I got here originally from StackOverflow. Very informative. I’ll be watching you.
Dear Lorenz
Excuse me, our team just began to work on GIS app. in Taiwan. We met some difficulties in creating QuickAction dialog. Could we use your code in our cadastral GIS product? We want to show this action in the main menu. Please let me know if you have any concerns,thank you.
Yours Sincerely
Satura
Awesome man, this is damn cool. Copying it in one of my project. Thanks.
not sure if anyone else encountered this problem but in the QuickAction class, showArrow method, i found that it would not show the arrow b/c of this line.
param.leftMargin = requestedX – arrowWidth / 2;
if u add parentheses shown below it will work
param.leftMargin = (requestedX – arrowWidth) / 2;
Thankfully i listen to a maths class when i was younger, go BODMAS
Hi Lorenz,
Great code!
I see that you have the updated code on NewQuickAction git hub. Are you able to tell me if that code is newest than the Gallery3D code example!? I use the gallery one, but i’m afraid to not be updated!
thanks!
rafa
Hi Rafael, yes the code is newest than Gallery3D example.
Hi! Congratulations, great job! I will start following your blog
What is the git hub url? Are these examples in a repository? I would be really usefull to be up to date with these really nice components
Thanks
Hi, thank you. This is the github url: https://github.com/lorensiuswlt/NewQuickAction
Hi, thanks for the source! I made a little modification to the quickaction: http://bit.ly/pxJr83
How to create nested quick actions???
How to create nested Quick Actions????
For example as given above:- When Button1 is pressed, Chart & Products is visible. When Chart is click, then also it should display a new Quick actions with different items…
hey lorenz.. first of all thanks a lot for providing this beautiful piece of code to everyone.
secondly i want to use quickaction on click on list view item or infact a button in list view. how do i find out which row of the listview fired the quickaction?
thirdly i wanna knw wats d difference in the quick action and new quick action code?
Hello Lorens, Thanks for your code
We are happy with the code Lorenz, many thanks
woah.. such a masterpiece .. thanks a lot. This will help me a lot. 🙂
Thanks a lot for your implementation. The result is outstanding.
I just have a little graphical issue. When I launch a different activity by tapping an ActionItem the background disappears for a short period of time and then the new activity launches. Although when I tap the item an hold it, the background becomes orange as suspected.
Hello,
Yes there is a bug in my implementation. The actionitem background becomes dark when the dialog dismissed. I’m working on fixing this issue. Watch my github repository for latest update.
Hi,
Very good job.
Is there a way to have icons on 2-3 lines ?
I m searching since 2 days without success.
VERY nice, Lorenz. Thank you SO MUCH, it’s exactly what I needed. I’m still fairly new at this, so not only was it something I can use, but it’s also a nice learning experience. Well done.
You’re welcome Tim..;)
Hello Loennz,
Thanks for your tutorial, How can make it Circular..give me some guidance .
thanks
My eclipse shows no ActionItem Class.. ???
what it’s showing…did u see files are available in your project folder or not
Hello Lorens, Thanks for your code. But how to insert new quick action dialog in quick action dialog??
Hi, what did you mean by insert new quick action dialog in quick action dialog?
Hi, what i mean is …. in your code when we will press Button1, it will show quick action having three items (Add,Accept,Upload). Now i want to pop up a new quick action having two or three items on pressing any option(Add,Accept or Upload).
Hi, i think that’s not a good pattern, showing new qa dialog on top/below other qa. The best way to implement your goal is by using extended layout just like in contact app. If a contact has more than one phone numbers, clicking on phone item on quickaction will expand new list view below the action item. you have to implement it manually 😉
Thanks a bunch for the code – I’m really looking forward to building an app with this included! 😀
One thing, though – when I try to implement your files into my app, they cause it to crash. PopupWindows line 35 (mWindow = new PopupWindow(context) ) causes an IllegalStateException – “System services not available to Activities before onCreate()”
I’ve called setContentView() in another class, and I’m pretty sure I’ve copied the files over correctly, so if you have any helpful tips, that would be amazing. 😀
Thanks for all of your hard work!
Hi you’re welcome, could you give me the code snippet?
dude make sure you are creating object at onCreate instead of just previous initialization of this function is called. e.g:
object aa;
oncreate {
aa = new bb();
}
Hi lorenz,
awesome work, again and thanks for publishing it on github. I am using your previous version of the code so. The new version which uses only one listener for all items doesn’t work for me. The problem with your solution is, you rely on the position of the clicked item. My quickaction list contains different amounts of actions depending on the state of the clicked item.
So even though your solution is shorter/simpler it isn’t as flexible as your first solution.
Just my two cents. Again, thanks for sharing this with the dev community.
Andy
Hi Andy, you’re welcome. Yes i’ve changed the current action item listener implementation, previous version will suits your needs 😉
Hi Lorenz,
Thanks so much for sharing this.
I’ve just included your code in one app I am working with and all seemed to work fine.
However, when I was playing around at one moment I doubled clicked too fast on the button that shows the quickaction dialog, not intentionally, but I did and the application force closed.
It was weird and I did not know if it was something in my code.
Then I opened your example and start noticing the same problem, but only on Example1 (on the list this is not happening). If I click repeatedly and too fast on the buttons (I know that this is not how you are going to use your app but it happened unintentionally the first time) the app crashes with the following error
ERROR/AndroidRuntime(8350): FATAL EXCEPTION: main
ERROR/AndroidRuntime(8350): java.lang.ClassCastException: android.view.ViewGroup$LayoutParams
ERROR/AndroidRuntime(8350): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3129)
ERROR/AndroidRuntime(8350): at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
ERROR/AndroidRuntime(8350): at android.view.View.measure(View.java:8313)
ERROR/AndroidRuntime(8350): at android.view.ViewRoot.performTraversals(ViewRoot.java:839)
ERROR/AndroidRuntime(8350): at android.view.ViewRoot.handleMessage(ViewRoot.java:1859)
ERROR/AndroidRuntime(8350): at android.os.Handler.dispatchMessage(Handler.java:99)
ERROR/AndroidRuntime(8350): at android.os.Looper.loop(Looper.java:130)
ERROR/AndroidRuntime(8350): at android.app.ActivityThread.main(ActivityThread.java:3683)
ERROR/AndroidRuntime(8350): at java.lang.reflect.Method.invokeNative(Native Method)
ERROR/AndroidRuntime(8350): at java.lang.reflect.Method.invoke(Method.java:507)
ERROR/AndroidRuntime(8350): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
ERROR/AndroidRuntime(8350): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
ERROR/AndroidRuntime(8350): at dalvik.system.NativeStart.main(Native Method)
I am using a Nexus One (Android 2.3.4), let me know if this is happening to you.
Thanks so much
Did you find a solution?
hello,
first of all it’s an awsome work!
i’m trying to integrate the quickActionBar, Gallery 3D like to my Action Bar(a reusable layout)
i’m getting a bug , the triangle it’s no longer attached to the square. i think it’s a problem of context , i have no idea how to fix it help!
thanks great Work
Very good work and article. I am planning to include this thing in my project. Thanks a bunch
Thank you, this article is very helpful! Good work!!!!!!!!!
Great example! I’m currently trying to implement this into my application, but unfortunately I use a custom view (onDraw and a canvas). Ideally, I’d like for the user to be able to touch any part of the screen and depending on where they touch, the quickaction menu pops up and has custom content (depending on the location of the touch). So currently I’m using an onTouchEvent, then locating the touch, then performing an action based on that location. How could I implement your code so when I touch the screen, the quickAction menu pops up and populates itself based on location?
So for example:
public boolean onTouchEvent(MotionEvent event) {
int eventaction = event.getAction();
int X = (int)event.getX();
int Y = (int)event.getY();
switch (eventaction ) {
case MotionEvent.ACTION_DOWN: // touch down so check if the finger is on a ball
int centerX = 80;
int centerY = 80;
if (X > centerX – 30 && X centerY – 30 && Y < centerY + 30){//POPS UP QUICK ACTION MENU WITH CUSTOM CONTENT HERE
}
}
break;
}
return true;
}
Thanks.
Great stuff! Big Kudos!
OK …. just perused you code … EXACTLY what I was looking for … BIG thanks again! 🙂
Thank you very much, I am looking for this codes long long time. Appreciated you shared on Github.
Hello Lorenz, your code is what exactly im looking for, however the popup.9.png doesn’t seem to appear. see attached screenshot: http://i.imgur.com/zaTrB.png
I think this code would be better for the onClick listener :
container.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v)
{
if (mListener != null)
mListener.onItemClick(pos);
v.post(new Runnable()
{
@Override
public void run()
{
dismiss();
}
});
}
});
Has anyone figured out how to use this with Fragments? I have a Left Fragment and a Right Fragment, both ListFragments. I want the QuickAction dialog to pop up when I click on a ListItem on the right. It pops up in the right spot vertically, but it’s within the Left Fragment, not the Right. Any ideas?
Thank you…it’s a great bit of code!
Thanks for bunch of code.
Hey thanks alot. A perfect example to implement QuickAction.
Thanks again
Bundle of thanks lorenz.. It really helped alot.
Keep posting
Cheers
Thanks for this amazing code!
I love it!
One question: Is there a way to modify the code so that this popup is able to show only something like an information, so that there is only text, without clickListner and so on?
I’m not a really pro in coding and hope you can help me 🙂
Greetings
Just leave the listener and icon empty..;)
Oh! Easyer then I thought ;D Thank you!
Working good but I am having one issue. When calling quickAction.show(v); in a button click it can crash with this in the log:
10-05 15:55:05.702: ERROR/AndroidRuntime(11608): java.lang.ClassCastException: android.view.ViewGroup$LayoutParams
10-05 15:55:05.702: ERROR/AndroidRuntime(11608): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3129)
10-05 15:55:05.702: ERROR/AndroidRuntime(11608): at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
10-05 15:55:05.702: ERROR/AndroidRuntime(11608): at android.view.View.measure(View.java:8330)
10-05 15:55:05.702: ERROR/AndroidRuntime(11608): at android.view.ViewRoot.performTraversals(ViewRoot.java:843)
10-05 15:55:05.702: ERROR/AndroidRuntime(11608): at android.view.ViewRoot.handleMessage(ViewRoot.java:1865)
10-05 15:55:05.702: ERROR/AndroidRuntime(11608): at android.os.Handler.dispatchMessage(Handler.java:99)
10-05 15:55:05.702: ERROR/AndroidRuntime(11608): at android.os.Looper.loop(Looper.java:130)
10-05 15:55:05.702: ERROR/AndroidRuntime(11608): at android.app.ActivityThread.main(ActivityThread.java:3835)
10-05 15:55:05.702: ERROR/AndroidRuntime(11608): at java.lang.reflect.Method.invokeNative(Native Method)
10-05 15:55:05.702: ERROR/AndroidRuntime(11608): at java.lang.reflect.Method.invoke(Method.java:507)
10-05 15:55:05.702: ERROR/AndroidRuntime(11608): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:847)
10-05 15:55:05.702: ERROR/AndroidRuntime(11608): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605)
10-05 15:55:05.702: ERROR/AndroidRuntime(11608): at dalvik.system.NativeStart.main(Native Method)
Posted fix: https://github.com/lorensiuswlt/NewQuickAction3D/issues/2
Hi Zammbi, thanx for the fix, i’ll update the repository…:D
This was really very helpful. Thank you so much.
Hi!
May I found a solution for your issue on github: https://github.com/lorensiuswlt/NewQuickAction3D/issues/1
Hi Vaan, thank you for the solution, i’ll make a test and update the repository….:D
mantap mas… saya punya 2 listview mas deng orientasi vertical, isinya banyak data tapi yang keliatan hanya 3 row aja gimana ya mas?jadi bisa di scrool buat liat semua datanya?thank you..
Bisa diperjelas lagi maksudnya? ada contoh screenshotnya ?
I have made a number of changes to the code that others may find helpful.
1) Action Item – new constructor with action id, title, icon
2) Callback enhanced to return QuickAction object as source and action id (allows you to add items in any order as you base what was clicked on by the ID, not the pos)
3) Action item supports sticky mode, if that is enabled the menu does not dismiss post button press. I needed this for my application.
4) QuickAction has getActionItem(pos) call so you can get action item back. QuickAction has ArrayList of added items to support this.
5) QuickAction supports constructor with horizontal flag so you can run menu horizontally instead of just vertically.
6) If doing horizontal QuickAction loads the action_item_horiz.xml and popuphoriz.xml files instead of the vertical ones.
7) Added action_item_horiz.xml with a centered image over a centered text label
8) Added horiz_separator.xml file so you can show a separator between items in a horizontal layout
9) Updated NewQuickAction3DActivity to show the toast message based on label of action item clicked as you now have enough info in callback to do that generically
I want to attempt to have all horizontal items show up same width by rolling through post add and getting max width and using that for all items. Not sure if that is possible.
I would also like to add a spacer action so you can group items with an extra gap. Might do that as a parameter to addActionItem(action)
I can send the code to you if you to look it over and see if my changes are acceptable and useful. I might take a day or so to polish it up and implement a few things mentioned above.
The existing code has been very helpful and I wanted to give back to others who are using it.
Hi Kevin, thanx for nice update, could u send me the code?
I sent you the code. I did an extra update so you can be notified when the menu dismisses. I use this as a “cancel” action in my code so I can clean a few things up once the menu is gone.
Hi guys, great work 🙂
Could you please push the modifications to Git or send them also to me?
Check out the github repo 😉
Thanks for sharing this code I really like it.
Defiantly going to use this on my app.
You’re welcome, don’t forget to check the latest update on github..;)
Hi,
i want the arrow in the middle of the popup as its everytime either displayed on right or left side.Any option to make it in center
The position of the arrow is based on where the anchor view is placed. If you place the anchor view at the center of screen, the arrow will be displayed at the center too.
lorenz,
I am trying to use your quick action for menu item on action bar (3.0) and not being able to place at the right place.
How can I do this in.
mActionBarView = getLayoutInflater().inflate(
R.layout.action_bar_custom, null);
public boolean onOptionsItemSelected(MenuItem item)
{
switch (item.getItemId())
{
…
mQuickAction.show(mActionBarView);
}
}
I know its because I am passing actionbar view as anchor view, how do I pass the menu item as the anchor view, is it possible?.
Help on this is highly appreciated.
Waiting for quick response 🙂
Thanks,
Harsha
sorry for the typo, Its because of the actionbar view am passing as anchor view.
Thanks,
Harsha
Hi Lorenz,
this is really great work and it seems it will suit my needs.
I just have a question re the implementation.
It is meant to be used as a library project, or should I rather copy everything in my own project tree ?
Thanks in advance,
JM
Hi Jean, thanks for choosing quickaction. You should copy everything into your project. You can also make changes to the drawables if you want to make custom theme. 😉
Hi Lorenz,
I did this as it was simpler indeed.
I have just made a small modification to your code.
I have added a tag object (like in View)to ActionItem. This allows “embedding” stuff into the ActionItem.
It proved necessary in my case and might be useful to other users (the code is VERY simple, just added the instance variable and getter/setter).
Thanks again for your great work.
Hi Jean, that’s great, you are free to modify the code to suit your need. Hope it usefull for your application..;)
Hi, I’m trying to adopt it to my project, I’d like to know do you have implementation for this to pop-up not from the top or bottom but from left or right?
Thanks.
Harut M.
Hi i’m trying to use this on my app but when i click on a quick action item too “quickly” the image doesn’t behave like it should, it disappear and shows the background color, if i click it “slowly” it works properly,
is there a way to fix it?
do you experience the same thing?
thanks
Matteo
Hi Zerho, yes there is a bug on quickaction. the solution is to create separate background drawable for popup menu. i’ll try to update the fix soon on github.
The transparent background bug still happens – android 2.2 HTC Desire. What is the problem there?
yes the bug still exists but i’ve managed to solve the problem, i’ll try to update the repo soon.
Any tips on how to fix this transparent ActionItem bug? Thanks!
just set background for popup window in QuickAction.java.
It works well on 2.1 platform without setting background, but on 2.3.3 problem with
transparency exists (emulator uses). If you set background in QuickAction class then the whole widget will be bigger and less attractively 🙂
Awesome code, thanks alot!
What is the minimum api level for the quick action?
Good work. I like this feature.
Works on 2.1 and above
Hey Lorenz,
Thanks for this cool code!!!
Is there any way to change an ActionItem’s icon or text, AFTER it has been added to the QuickAction?
I’ve tried…
myActionItem.setIcon(getResources().getDrawable(R.drawable.ic_checked));
and
quickAction.getActionItem(0).setIcon(getResources().getDrawable(R.drawable.ic_checked));
but without success. I’m trying to implement a checked/unchecked state on a sticky ActionItem. Any suggestion on how to do this?
Thanks,
Rob
I have finally found the solution for transparent background problem. The thing is that popup window is dismissed too early so just put this piece of code in PopupWindows class, dismiss() method:
public void dismiss() {
new Thread(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(1500);
mWindow.dismiss();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}).start();
}
I hope it helps…
I think 250 ms delay is a better choice than 1500 ms.
Nice work and article :). I’m using quickaction in my project, it works very well in smartphone app, but i have a problem when i try to show it in a Dialog, the quickaction appears in other place outside the dialog, what can i do in this case? 🙁
Good job !!!
The code works perfect and the design is very easily customiziable, Great work!
The only problem I currently have is that the PopupWindow consumes the touch event needed to dismiss itself, without delegating it to the other controls.
I tried various ways to work around this, including unsuccessful try to set FLAG_NOT_TOUCH_MODAL but still not working.
Any help will be greatly appreciated!
Have anyone else had this problem and managed to fix it somehow?
I see that the default camera app in Android 3.1 have quite nice kind of quick action menus, but the focus is not consumed, so you ca switch to (open) the next menu directly while closing the current one. So it is possible for sure 🙂
Great article. I’ve used the QuickAction bar in the Greendroid library but never seen how to create the Gallery Like one. Really like this quick action, thanks for sharing.
incredibly helpful thank you!!
would be nice to just download the source project and work with that
but still helped a lot 🙂
I recently noticed, that on a big screen (like a Honeycomb tablet) the popup is positioned very weirdly and also the triangle below (above) the popup isn’t displayed.
The strange thing is: Although this happens in landscape mode, it doesn’t in portrait mode.
This works perfectly for a project I’ve been working on. I have a couple of questions though. First, I notice that the 3D version doesn’t scroll horizontally if there are more items than can be displayed. Also, is there a way to make the quick actions pop up to the side of the anchor instead of above/below? A fix to either the horizontal one not scrolling or popping a vertical list to the side of an anchor would help a lot. Let me know if I’m missing something. Thanks again!
hi plz tell me how to add sub menu to any of the menu items in QuickAction?
Thanks
tutorial yang sangat membantu. terima kasih.
oh iya, klo untuk pop up window yang menampilkan textview ada tutorialnya ga mas? klo bisa sih di buat juga, saya sudah searching di google belum ada yang tepat penjelasannya…
Hi Excelent
Is it possible to get the pop up window to point to the select item in a custom list. At the moment it points to the list hold not the row item selected. if so how.
Thanks
Thanks for the great piece of code!
I am attempting to change the title on an action item after I have created the action item. It doesn’t seem to be updating. I am using the following code:
quickAction.getActionItem(2).setTitle(“Remove Star”);
Did you fix this issue? I’m stuck here.
Did you find a solution for this issue?
Thanks for this work. It helped me in my free app that I published on app store. Drop me an email if you would like a link or search using my email ID before gmail.com. Really appreciate your hard work.
Thank you for this it is really a nice piece of work. Is there a way to remove and add new items during program run?
Can you support all display sizes, please.
I have in each ActionItom white lines in the background, so i think the grey background image or color is not for my display size of 320 x 240 Pixels configured. Thanks
Bug report:
I’ve tried the list example, when you click over an item it always come through false on the if clause, so don’t have really a action tha can be handled there…, the Strange things is over the buttons it works fine, with almost the same code…
Despite of it, it’s a great work!! congratulations
I just have a problem..
When I press the button, the QuickAction is shown normally but when the QuickAction is still shown then I switch the emulator from portrait to landscape mode, the QuickAction position is somehow not positioned in the button that I pressed before..
Any suggestion how to prevent this??
This is really great work and very easily customizable and documented. I did notice one issue though that you have not notice it on a BLACK background but it is very obvious on lighter colors backgrounds. When you click on an Action Item before the Presse State takes place, the item DISAPPEARS monetarily. Do you know why is this happening ? your answer will be greatly appreciated. Thanks
I’m trying to display this inside a web view. When I show the quick action menu it doesn’t really wrap the content. The buttons are all there, but the background is just that 9 patch image, complete with the guides still showing. Has anyone run across something similar?
So it turns out that this looks fine as long as I have icons that are exactly the size of the icons in the example.
Hi Brandon, do you have any tutorial about that? thanks a lot!
Hi! Thanks a million for your great work!
I run into a problem which is maybe interesting for you, maybe you can help me!
I posted it already on stackoverflow
http://stackoverflow.com/questions/10109526/combination-of-service-progressbar-gridview-and-his-notifydatasetchanged-an
this post is so helpful and so nice but is possible to update the 3d part to can add multi row icons i want use it to add emoticons in the view in mtrack u use linear layout i want to put table layout
On ICS the animation on the slide are very bad, any suggestion?
Hi, this is really great! Does anyone know how to implement this from an onSingleTapConfirmed, where I only have a MotionEvent and no View?
Thanx in advance!
HI,
Thanks lot for such an amazing control, its working perfect in my phone.. Thanks lot for posting the code…
congratulations for the wonderful job.
You can start the activity with QuickAction already open,
without using the method onClick ()?
I was wondering if it’s possible to add a view (xml) in Quick Action. I have designed a table layout in xml and not sure how to fit that into QuickAction.
Waw! great! thx for your share… Keep post! 🙂
Thx for your code. It’s quite helpful for me but i have a problem. Popup’s width is not full screen. How can i solve that?
hi. using your Gallery3D-like QuickActions, what if this will be used in a tablet, how can the menus get bigger?
just use bigger icons?
Thx for your code. It’s quite helpful for me but i have a problem. But I have problems with Popup,when I use android 4.0.3 to run the project.(the display size is 5.4 in FWVGA),The Popup’s size is much bigger I expected,and when the button is in a FrameLayout,(the FrameLayout in the scren’s bottom) the arrow of the Popup is still the down ones.Do you know why?
Hi
the code is working fine only the Horizontal separator is not coming for the quick action any suggestions for the problem ?
Thanks
KD
hey, lorenz:
Thanks, It is great!
But I found a problem, the source has not set minSdkVersion, so when I set one as my app, the quickaction_slider_btn_normal.9.png will not scale well:-(
It is ok when minSdkVersion deleted.
Regards
Zhimin
Can you add xhdpi image resources?
Do anybody know how to set the dialog height? its too big in my tablet.
tks
Great!!! Thank you so much
Thanks, It works nice.
You need to add this in the AndroidManifest.xml:
This will fix the display issues, like the text being too big in places, and the Toast messages being too small.
Hi
Thanks for nice tutorial.
I need to Add simple Listview in QuickAction Dialog.
Pls suggestion me any suggestion for this
i have create some stuff but not solved
pls check this
http://stackoverflow.com/questions/12129689/how-to-add-listview-in-quickaction-dailog-in-android/12129718#12129718
hello brother. Can you give me sample about how to inject radio button on list menu drop down like?
Hello Bro….
The application you have posted is really awosome flag for u….
Hello,
This library is great, the sample application seems to work but when I added it to my library in my application I get an NullPointerException error when I’m adding the action item on the quick action.
Can anyone tell me what’s happening?
I imported the class folder NewQuickAction3D/bin/classes but am running into a NoClassDefFoundError. Clearly I am doing something wrong.
What is the correct way to import QuickAction3D into a project? Should a user export a .jar file and then import it? if so what is exported into the .jar file? Or should one import a Classes folder? for us/me a little new at Eclipse/ Java it would be great to have this tip. Thank you.
OK, I got a little bit farther, I added a class folder of NewQuickAction3D/bin/classes and from QuickAction3D exported a .jar and imported it into my project, but now running into a runtime error when setting the mRootView.
public void setRootViewId(int id) {
mRootView = (ViewGroup) mInflater.inflate(id, null);
Obviously I’m doing something wrong, so a quick steps on how to properly import QuickAction3D into a project in eclipse would be appreciated. Thanks!
I want to implement a Quick Action Dialog .After searching in web I have found a very nice tutorial in this link :
http://www.londatiga.net/it/how-to-create-quickaction-dialog-in-android/
Everything was working ok, but i tried to use it in a dialog and it didn’t work. I want a simple and short tutorial for this . Can you give me a code with just a button in layout and in code if I press the button a quick action dialog will appear ??
hi, Thank u for giving good example on Quickaction Dialog…
How to break into 2 parts in dialog… just check this link for more info…
http://stackoverflow.com/questions/12351670/quick-dialog-using-onclick-search-view-in-android#comment16587604_12351670
thank u once again Bro…
i have implemented your code according to my requirement i need to add dynamic data in popup list but i’m unable to do this please suggest me how to do this thanks for excellent code.
Hi, first, thank you very much for your code. It helped me with my job. But I have a question about the second code.
I need do my own quickaction with my own res, but with your code I don’t get remove the black background. Where is declarated the background? I thought in the popup_vertical.xml file but the black background continue. How can I change the style of my quickaction.
Sorry for my english.
Regards
Hi, thank you for your code.
I have a problem when I try modify ActionItem title.
@Override
public void onItemClick(QuickAction source, int pos, int actionId) {
ActionItem actionItem = quickAction.getActionItem(pos);
if (actionId == 0) {
actionItem.setTitle(“New title”);
}
etc…
I miss something?
Thank you again.
Well finally I rebuild all QuickAction & QuickItems and works good. But I dont understand what does setTitle, setActionId, etc if dont change anythng.
Thank you.
Hi,
Please show me, how you process?
Hi,can u plz tell me where to post this code… I mean where shud I keep this code in library??
I get an error when I write ActionItem in Java file.
Thanks.
to marav
Thanks very much.
Hi Thank you for this helpful post.
I am new to Android dev and I want to use your implementation on my current Android app project.
I am using Mono for Android, VS2010 plugin. I just want to ask how can I incorporate or reference your implementation on my project
Thank you very much!
Thanks for the awesome tool. I tried to use it, but it seems to pop up covering my button, rather than popping up from it, like your examples…any ideas?
nevermind, my button was in a different layout, once i moved the buttons out it worked.
Thank you, that’s fine. But I have a question. How to display the menu
mQuickAction.show(v);
to do when the user clicks the physical menu button?
replace view1 with the name of the buttons view you want the QA to popup from.
Perhaps you should learn android a little better, as capturing hardware button presses is a fundamental task in android.
@Override
public boolean onKeyDown(int keycode, KeyEvent e) {
switch (keycode) {
case KeyEvent.KEYCODE_MENU:
View v = (View) findViewById(R.id.view1);
mQuickAction.show(v);
btnSocialMenu.performClick();
return true;
}
return super.onKeyDown(keycode, e);
}
remove the “btnsocialmenu…” code, I have my menu key doing something else in my app besides triggering the QA menu.
Hi there! Finally I succeed and make the QuickAction work for my app. Now I am thinking if I can manage to make the slider or the icons to be in the center of the QucikAction Slider. Is there any way solving this? 😀
Thanx
For those that did make this work for your App how did you do it? Did you export a .jar file? if so what did you include in the .jar? did you import a class folder? if so which folder(s) ? I ran into NoClassDefFoundError at first (see above) and other problems later once I got the .jar in, but… how do I know if I am importing this code “the correct way” ? what is the correct way?
Hi all,
we have using mQuickAction.addActionItem(upAction); code for add item.
similarly what code we have to use for remove item?
hi, friend my name is mayank langalia
i’m android app. developer
i want to create like below gridview type menu have you any sample code ?
if yes then please send us …
need your help for creating like below image.
http://www.edumobile.org/android/wp-content/uploads/2011/09/quick_action_grid.png
Nice utility you have give here. Can u plz tell me how to change the backgroung of the floating menu, which is currently Black. thanks in advance.
Hi, really nice blog, Thank you for your effort to implement this feature control to fancy the old fashioned spinner view.
hi, friend my name is mayank langalia
i’m android app. developer
i want to create like below gridview type menu have you any sample code ?if yes then please send us …
need your help for creating like below image. http://www.edumobile.org/android/wp-content/uploads/2011/09/quick_action_grid.png
Very Usefull Blog … it worked me perfect but i am trying to get different images on different options. I used this code but it taking only one images as selected but i need to differ. i did like this if (actionId == ID_DATE_TO_REMEMBER) {
dateToRemember.setIcon(getResources().getDrawable(R.drawable.datestoremember_active));
Toast.makeText(getApplicationContext(), “Let’s do some search action”, Toast.LENGTH_SHORT).show();
}
but it is not working… can you suggest me how to solve ???? Thanks in Advance
It’s nice, but can it also scroll down when no space is available?
M.
Kudos!!
Fantastic Job!
Thanks!
Hi,
I am attempting to change the title on an action item after I have created the action item. It doesn’t seem to be updating. I am using the following code:
quickAction.getActionItem(2).setTitle(“Remove Star”);
Really nice work. Very help tutorial. Many thanks! Keep it up. 🙂
I am trying to integrate this library with ActionBarSherlock. However, quick action menu is not displayed on clicking the action bar item. Any suggestions?
Is there anyway to customize the menu layout??
Is there any way to customize the menu layout??
Thanks
Hi
Thanks for your great effort ….
When I replace this toast on onItemClick(QuickAction quickAction, int pos, int actionId)
if (actionId == ID_ADD) { //Add item selected
Toast.makeText(ContextApp.getAppContext(), “Add item selected on row ” + mSelectedRow, Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(ContextApp.getAppContext(), actionItem.getTitle() + ” item selected on row ”
+ mSelectedRow, Toast.LENGTH_SHORT).show();
}
by this piece of code to jump to intent
Intent i = new Intent(getActivity(), DoctorVisit.class);
startActivity(i);
It gives an error
I am new to Android Development but I want to set quick action dialog to gridview item click but I can’t.. Can you please help me to pass the view to show the dialog.
Can i set to a gridview item? please describe
I am trying to set with a gridview item click but I am unable to pass the view (gridview item) to show which require as quickaction.show(view);