Android Question How to use B4A.Callsub (Webviewextras)

jimcorr

New Member
Licensed User
Longtime User
Hey guys!

I'm since yesterday without any success trying to make b4a.callsub to execut any b4a code.

I tried to create my own code using the examples and the documentation and the sub called just doesn't fire.

I even tried an exemple in this post:

https://www.b4x.com/android/forum/threads/html-table-parsing-need-demo.26932/#post-156015

And the sub ParseHtml just doesn't show the log which makes me thing that the sub is not firing too.

Any ideas or examples that can help me?

Thanks,

Rafael

PS: I'm testing my application on a samsung tab e, it's not on any emulator, if it makes any difference.
 

jimcorr

New Member
Licensed User
Longtime User
I couldnt upload it here, because of its size, but i put it here:

http://www.rafaelcorr.com.br/capd.zip

To test it, you must open the menu, and select "test option"

Then, select one of the radiobuttons on the html and then click the "Edit" button.

That should show the log.

Thanks!
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
what i see is that you try to call from activity main a sub that is in activity pressao that should start activity pressao. how should that work??
you cannot start an activity from it self!

you could just call directly in main activity > sub get_teste > StartActivity("pressao") and start activity pressao like this.

the same in Sub abre_liquidos_principal, you call a sub that should start the activity.

if you would like to start it in a short delay you should use CallSubPlus: https://www.b4x.com/android/forum/threads/callsubplus-callsub-with-explicit-delay.60877/#content

i have just commented the lines Startactivity since you start the activity already with callsubdelayed and the sub is called

see logs:

LogCat connected to: 4b2f02ef
--------- beginning of main
--------- beginning of system
Copying updated assets files (15)
** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
criou db
Billing service disconnected.
** Activity (main) Resume **
Billing service connected.
Checking for in-app billing 3 support.
In-app billing version 3 supported for www.sagitalbs.net
Subscriptions AVAILABLE.
Ignoring event: manager_billingsupported
** Activity (main) Pause, UserClosed = false **
** Activity (liquidos_principal) Create, isFirst = true **
** Activity (liquidos_principal) Resume **
<head><script type="text/javascript"> function myFunction() { document.getElementById("demo").innerHTML = "changed!!!"; }function myFunction1() { document.getElementById("demo1").innerHTML = "changed!!!";}</script></head><html><body> <p id="demo"onclick="myFunction()">Click Me To change my text color.</p> <br /> <br /></center><form><table align="center" id="tableID" border="1" style="cursor: pointer;"> <tr> <td><INPUT TYPE="radio" NAME="OPCAO" VALUE="radio1"></td> <td>Text</td> <td><p id="demo1"onclick="myFunction1()">Click here</p></td> <td>Lorem</td> <td>Ipsum</td> </tr> <tr> <td><INPUT TYPE="radio" NAME="OPCAO" VALUE="radio2"></td> <td>Text</td> <td>MoreText</td> <td>Lorem</td> <td>Ipsum</td> </tr> <tr> <td><INPUT TYPE="radio" NAME="OPCAO" VALUE="radio3"></td> <td>Text</td> <td>MoreText</td> <td>Lorem</td> <td>Ipsum</td> </tr> <tr> <td><INPUT TYPE="radio" NAME="OPCAO" VALUE="radio4"></td> <td>Text</td> <td>MoreText</td> <td>Lorem</td> <td>Ipsum</td> </tr></table></form><br/> </body></html>
i was called from activity main

"i was called from activity main" i put this line in the sub you want to call.

bottom line Callsubdelayed starts the activity already so no need to start it again. and you CANNOT start an activity from it self because it doesnot make sense to start an activity that is already running o_O
 

Attachments

  • capd.zip
    31.4 KB · Views: 196
Last edited:
Upvote 0

jimcorr

New Member
Licensed User
Longtime User
This activity pressao is not ready, and i'm not even calling it from nowhere.

And about abre_liquidos_principal, i`ve created a sub because i`m gonna add some code in that sub, it's just nor ready yet.

But my problem is not calling the activity, the activity opens fine, my problem is related with the callsub inside the javascript.
 
Upvote 0

jimcorr

New Member
Licensed User
Longtime User
Ah, yes, but get_teste is never called, i've just left it there for the future.

But do you think that my problem is related with the way i'm calling the activities?
 
Upvote 0
Top