Android Question Wait for in class module

rraswisak

Active Member
Licensed User
Longtime User
hi all, need some help here please...

i plan to create app with many layout file, rather using many activity i split all of them into classes.

if wait for was call at main activity it's work normally. but problem when using wait for at class module, the error say that procedure i called was not found

The goal is, show another activity from class and return the value given. here i attach sample project which describe my app behavior.

Many thanks for your time and enlightenment
 

Attachments

  • Test.zip
    12.3 KB · Views: 200

rraswisak

Active Member
Licensed User
Longtime User
Thank you Erel for you response

when Show Dialog Layout To Panel buton was click this will load another layout (2.bal) which done at CDialog class onto panel1, then there is another button Show Fruit Dialog, when clicked DialogActivity (contain 3.bal) will show up, there two option to pick, after pick one of then the error occur, here is the log:

** Activity (main) Pause, UserClosed = false **
** Activity (dialogactivity) Create, isFirst = true **
** Activity (dialogactivity) Resume **
** Activity (dialogactivity) Pause, UserClosed = true **
sending message to waiting queue (CallSubDelayed - FruitSelect_Done)
running waiting messages (1)
main$ResumeMessagerun (java line: 306)
java.lang.Exception: Sub fruitselect_done was not found.
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:197)
at anywheresoftware.b4a.keywords.Common$11$1.run(Common.java:1139)
at anywheresoftware.b4a.BA.setActivityPaused(BA.java:437)
at b4a.example.main$ResumeMessage.run(main.java:306)
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:4745)
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:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)

if everything ok, there should be two toast message
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Your code is wrong:
B4X:
CallSubDelayed2(Main,"FruitSelect_Done",Value)
There is no such sub in Main module.

I think that you shouldn't implement the dialog in a different activity. It makes things much more complicated than they should be.
Make DialogActivity a class.
Pass Panel to ShowActivity (Activity can be treated as a panel).
Make ShowActivity return a ResumableSub.

Add the views to the panel and later remove them.


Or just use CustomLayoutDialog from the dialogs library.
 
Upvote 0
Top