AHQuickAction library - Nice looking popup menus

Discussion in 'Old Libraries Archive' started by corwin42, Feb 1, 2012.

  1. corwin42

    corwin42 Expert Licensed User

    This library is deprecated. If you develop for Android 3.0 and above (API11) you should use PopupMenu object of the StdActionBarHelper library .
    Development has stopped on this library.

    This library provides three objects for some nice looking popup menus.

    The AHQuickAction object is a popup window with horizontally aligned items. You can see this popup window in many apps like Tapatalk or Folder Organizer.

    The AHQuickAction3D object is a popup that can be used horizontally and vertically. You can find a similar popup in many Google apps like 3D-Gallery and Text&Tables.

    The AHPopupMenu is an ICS style menu.

    This library is somewhat different to other libraries because it makes use of standard Android resource files. Resource files cannot be published inside a .jar file and so you have to copy them to your Basic4Android project directory.

    Copy the whole "res" directory structure to the "Objects" directory of your B4A project and VERY IMPORTANT: make alle the files you have copied READ ONLY! Otherwise B4A will delete them when compiling. After you make any change to the Objecs/res directory use "Clean project" menu item in B4A to force the compiler to recreate the R.java file.

    If you forget to make the resource files read only then you will most likely get a ResourceNotFound exception when you try to use the popup objects.

    The objects are ported from open source projects and you can find them here:

    Installation instructions:
    - Copy the .xml and .jar files to your custom libraries folder
    - Copy the res directory to your projects "Objects" folder
    - Make all files copied to the Objects/res folder read only

    Version history:
    - initial version

    - Fixed positioning/sizing problem with AHQuickAction3D
    - Improved positioning/sizing with AHQuickAction (many thanks to barx)
    - Added ICS Style Menu (many thanks to thedesolatesoul)
    - Added ItemCount property to get number of items

    - Fixed positioning of QuickAction popup (sometimes didn't show above anchor)

    Have fun with it

    Attached Files:

    Last edited: Jul 18, 2014
  2. Erel

    Erel Administrator Staff Member Licensed User

    Looks great!


  3. moster67

    moster67 Well-Known Member Licensed User

    Thank you Markus!

    With your latest libraries you are continuously spoiling the B4A-community with really nice and important features.

    I can't test in this moment but will surely do so later.
  4. corwin42

    corwin42 Expert Licensed User

    I just have updated the .jar of the library in the first post because I forgot to remove some debug info. If you have downloaded the library, please download again. Otherwise no changes so I leave the version the same.
  5. susu

    susu Well-Known Member Licensed User

    Very nice ActionBar view! Thank you for your sharing :D
  6. corwin42

    corwin42 Expert Licensed User

    Its just a popup menu. ActionBar is coming next :D
  7. bluedude

    bluedude Well-Known Member Licensed User


    Awesome, just what we needed. And now the action bar :) BTW, should be possible to use an action bar at top or bottom (see Android gMail).
  8. Inman

    Inman Well-Known Member Licensed User

    Great work. Your libraries definitely enhance the stock Android UI.
  9. metrick

    metrick Active Member Licensed User

    Thanks for sharing.
  10. Paulsche

    Paulsche Well-Known Member Licensed User

    Super Library, danke.
  11. magarcan

    magarcan Active Member Licensed User

    Really interesting. Thanks for sharing ;)
  12. Filippo

    Filippo Expert Licensed User

    Hallo corwin42,

    erstmal vielen Dank für diese Library.

    Bei der "AHQuickAction3D", in der Vertikale ausrichtung, finde ich den Abstand von Element zu Element einfach zu klein, gibt es da eine möglichkeit diese Abstand zu vergrössern?

    first thank you for this library.

    In the "AHQuickAction3D" by the vertical Alignment, I find the distance from element to element just too small, is there a possibility to enlarge this distance?

  13. corwin42

    corwin42 Expert Licensed User

    Yes, this is possible. Since all the layouts are defined in XML files you can make changes to them.

    I currently don't have access to the sources but have a look in Objects/res/layout. There should be a file called something like "ahqa_item_vertical.xml". That is the layout for the vertically aligned items. I think you can add some top and buttom padding to the layout to make the items larger.

    Be aware that you make the file read only again after you edit it.
  14. hbruno

    hbruno Member Licensed User

    ListView ?

    Hi Markus,

    First, this a very nice object. :sign0098:

    In a program, i've attached a QuickAction with a ListView like this :
    Sub ListView1_ItemLongClick (Position As Int, Value As Object)
    End Sub
    The QuickAction always show at the same place, whatever the selected item.
    Is it possible to point the selected item ?

  15. corwin42

    corwin42 Expert Licensed User

    Unfortunately not.

    It would be very easy if the ItemLongClick event would provide the view that causes the event but unfortunately it does not. Perhaps we can ask Erel to add this as a parameter to the ItemClick and ItemLongClick events. Should be a 5 minutes change for Erel.

    I will add a request for this.
  16. latcc

    latcc Banned

    Very nice work!!

    Presumably this new style MENU system is called from an on-screen button. Does anyone know how this button appears in apps, or do we just make this button look as we feel fit?
  17. fpdianzen

    fpdianzen Member Licensed User

    i can't make this work on my existing project, when i copy the res files into my object files, it gives an error that i need to somewhat declare the resources. how can i do that? :sign0104:
  18. Erel

    Erel Administrator Staff Member Licensed User

    You should press on Tools - Clean project. This deletes an automatically generated file and forces the compiler to recreate it.
  19. corwin42

    corwin42 Expert Licensed User

    Erel had a nice workaround for this. It's not perfect but works in most cases

    Attached Files:

  20. Erel

    Erel Administrator Staff Member Licensed User

    A better solution using Reflection library:
    Sub ListView1_ItemClick (Position As Int, Value As Object)
    Sender, Position))
    End Sub

    Sub GetViewAtPos(LV As ListView, Position As Int) As View
    Dim r As Reflector
    Dim v As View
       r.Target = LV
    Dim first As Int
       first = r.RunMethod(
       v = r.RunMethod2(
    "getChildAt", Position - first, "java.lang.int")
    Return v
    End Sub