B4A Library InputMenu Library

For an app Im working on I needed a simple InputList with no radio buttons and no check boxes.

This has been requested before

So Ive written a really small library to do just that.

Its called InputMenu (as suggested by the thread above).

Very simple to use as it takes the same parameters as the built in InputList

B4X:
Dim im As InputMenu
Dim L As List

L.Initialize
L.Add("Item #1")
L.Add("Item #2")
L.Add("Item #3")
L.Add("Item #4")
   
Dim result As Int
result = im.Show(L,"Pick an Item")

The result is a menu of items to pick with no radio button or check box.

attachment.php


Library and demo source attached.
 

Attachments

  • Screenshot.png
    Screenshot.png
    30.2 KB · Views: 1,198
  • InputMenu.zip
    4 KB · Views: 646

sgt

Member
Licensed User
Longtime User
Hi thanks for this library is does what I want.

However I am getting the following error in the IDE log that is causing my app to crash. I have an activity that has a GPS view that when updates the location details calls a HttpJob to get data to update a label description. On the same activity I have a number of panels that use your InputMenu to display a popup menu.
If you display the InputMenu and the GPS and HttpJob has NOT completed (GPS not locked in or the HttpJob has not finished) when it is first displayed and then the GPS and HttpJobs does complete and update the label description while the InputMenu is still being displayed without you selecting anything and then select any menu option from the InputMenu causes this error. If the GPS and HttpJob have completed first and you display the InputMenu it works as expected.

I am not sure if this issue is a Errol fix or the issue is in the InputMenu Library. It seems to me its some sort of threading issue

Thanks for your help

B4X:
java.lang.NullPointerException
    at anywheresoftware.b4a.Msgbox$DialogResponse.onClick(Msgbox.java:118)
    at com.android.internal.app.AlertController$AlertParams$3.onItemClick(AlertController.java:934)
    at android.widget.AdapterView.performItemClick(AdapterView.java:301)
    at android.widget.AbsListView.performItemClick(AbsListView.java:1276)
    at android.widget.AbsListView$PerformClick.run(AbsListView.java:3067)
    at android.widget.AbsListView$1.run(AbsListView.java:3963)
    at android.os.Handler.handleCallback(Handler.java:615)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4898)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
    at dalvik.system.NativeStart.main(Native Method)
 
Top