AHQuickAction library - Nice looking popup menus

andrewmp

Member
Licensed User
Longtime User
Great library - I have a small problem - I need to dynamically add and remove menu items , have you got any suggestions how I could do this?
 

walterf25

Expert
Licensed User
Longtime User
Awesome library

wow, this is such a great library, i'm loving b4android more and more, this is very awesome, i just added this library to the app i'm working on, i was using the addmenu function, but now that i added this library i can display a pop up menu when the menu key on my phone is pressed, i love it, thanks Erel!

:sign0098:
 

andrewmp

Member
Licensed User
Longtime User
Tried it already - index out of bounds addactionitem

To see prob. in your example , remove the init code out of Activity_Create add this sub:

Sub LoadButtons(FirstTime As Boolean)

Dim Filename(9) As String
Dim text(9) As String
Dim ed As Int

Filename(1) = "menu_up_arrow.png"
text(1) = "Prev"

Filename(2) = "menu_down_arrow.png"
text(2) = "Next"

Filename(3) = "menu_info.png"
text(3) = "Info"

Filename(4) = "menu_eraser.png"
text(4) = "Delete"

Filename(5) = "menu_search.png"
text(5) = "Search"

Filename(6) = "menu_cancel.png"
text(6) = "Cancel"

Filename(7) = "menu_ok.png"
Text(7) = "Ok"

Filename(8) = "menu_ok.png"
Text(8) = "Test"

If FirstTime Then
ed=7
Else
ed=8
End If

ac1.Initialize("AC")
ac2.Initialize("AC", ac2.VERTICAL)
For i = 1 To ed
Dim ai As AHActionItem
Dim bd As BitmapDrawable


'Initialize a bitmap drawable and the action item
bd.Initialize(LoadBitmap(File.DirAssets, Filename(i)))
ai.Initialize(i,Text(i), bd)
ai.Selected = True

'Make the Prev and Next items sticky so they will not close the popup
If i = 1 OR i = 2 Then ai.Sticky = True

'Add the item to both Quickactions popups
ac1.addActionItem(ai)
ac2.addActionItem(ai)
Next

End Sub

Add another button that calls LoadButtons(false) and you will see the error

Thanks for the reply
 

corwin42

Expert
Licensed User
Longtime User
Add

B4X:
Dim ac1 as AHQuickAction
Dim ac2 as AHQuickAction3D

in the beginning of the sub to let the Object be recreated.

PS: Please use CODE tags when posting source. It's much better to read.
 

mkvidyashankar

Active Member
Licensed User
Longtime User
I am trying to include this into my app

B4X:
 Dim ac2 As AHQuickAction3D

  Sub Activity_Create(FirstTime As Boolean)

   
   
   '-------------------------------
    ac2.Initialize("AC",ac2.VERTICAL)
    .
.
.
.
.


end sub

I have copied all files in the res folder to objects folder

but I am getting error


Resources$NotfoundException:Resource ID#0x0

am I missing any files


log is


LogCat connected to: B4A-Bridge: LGE LG-P500-354043045942903
--------- beginning of /dev/log/system
--------- beginning of /dev/log/main
main_activity_create (B4A line: 129)
ac2.Initialize("AC",ac2.VERTICAL)
android.content.res.Resources$NotFoundException: Resource ID #0x0
at android.content.res.Resources.getValue(Resources.java:892)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:1869)
at android.content.res.Resources.getLayout(Resources.java:731)
at android.view.LayoutInflater.inflate(LayoutInflater.java:318)
at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
at de.amberhome.quickaction.QuickAction3D.setRootViewId(QuickAction3D.java:125)
at de.amberhome.quickaction.QuickAction3D.Initialize(QuickAction3D.java:79)
at com.camera.main._activity_create(main.java:414)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:113)
at com.camera.main.afterFirstLayout(main.java:84)
at com.camera.main.access$100(main.java:16)
at com.camera.main$WaitForLayout.run(main.java:72)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
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:860)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
at dalvik.system.NativeStart.main(Native Method)
android.content.res.Resources$NotFoundException: Resource ID #0x0
 
Last edited:

mkvidyashankar

Active Member
Licensed User
Longtime User
I got it
i forgot to use "Clean project"

Great Library !!!!!!!!!!!!!!!!!!!!!!!
 

Amalkotey

Active Member
Licensed User
Longtime User
Great! Thanks for sharing.
 

bluedude

Well-Known Member
Licensed User
Longtime User
Some problems

Hi,

I started integrating the library but for some reason I get this message:

Resources$NotFoundException: Resource ID #0x0 at android.content.res

I know for sure I have all read-only in the res folder and it is an exact copy of the test project.

My test project works fine (only a project with this library) but my real projects seems to have problems and shows above error.
 

bluedude

Well-Known Member
Licensed User
Longtime User
Using Actionbar with Quickaction3D

because this actionbar does not support the settings menu in a proper manner (Icecream) I was testing the Quickaction3D. However, this also gives me a problem.

When clicking the overflow the Quickaction3D does show but in the wrong position. I guess Android interface guideline wise I'm stuck because I cannot use all the custom UI elements together.

Anyone a solution?
 

corwin42

Expert
Licensed User
Longtime User
Looks perfect for me.

You should use this:

B4X:
Sub AB_ItemClicked(ItemID As Int)
   Menu.show(AB.GetActionView(ItemID))
End Sub

AB is the AHActionBar
Menu is the AHQuickAction3D
 

Attachments

  • 2012-02-22 21.10.35.jpg
    2012-02-22 21.10.35.jpg
    5.7 KB · Views: 462

William Hunter

Active Member
Licensed User
Longtime User
AHQuickAction library

This looks very good, but I have a quick question. Is there a way to show the popup menu using the device MENU button rather than needing to DIM an application Button to provide the AnchorView? :sign0104:
 
Top