Android Code Snippet Using StartActivityForResult with JavaObject

b4auser1

Well-Known Member
Licensed User
Longtime User
I started to prepare sample and found the root of problem.
I used local variable:
B4X:
Private IOnActivityResult As Object = jo.CreateEvent("anywheresoftware.b4a.IOnActivityResult", "IOnActivityResult", Null)

while the original code used global one

B4X:
Sub Process_Globals
   Private ion As Object
End Sub

I changed local to global and it works now correct.
 

LucaMs

Expert
Licensed User
Longtime User
April 2014 !!!
It is possible to use it also to call internal activities? (Yes, you've already responded to me that I can use CallSubDelayed, but you did not developed this at that time )

There are no advantages for this method over CallSubDelayed. CallSubDelayed is simpler to use and is actually more powerful (for internal activities).

There could be an advantage: you could use it to know if the Activity was resumed.

"Recently" I have had problems about this; using startActivity, the following instructions will be executed immediately, without knowing if the Activity was completely activated (Activity_Resume raised).

So, if you can implement StartActivityForResult even for B4A Activities (and if it waits)...


Thank you
 

trueboss323

Active Member
Licensed User
Longtime User
Hey Erel,
If using this with a share intent, can I determine whether sharing was successful ?
 

trueboss323

Active Member
Licensed User
Longtime User
I'm using the share intent

B4X:
Dim in As Intent
in.Initialize(in.ACTION_SEND, "")
in.PutExtra("android.intent.extra.TEXT", "This is my text to send.")
in.SetType("text/plain")
in.WrapAsIntentChooser("Share Via")
StartActivity(in)
 

FabioG

Active Member
Licensed User
Longtime User
Hello,

how can I open this pircker with a specific item selected?

 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…