Java Question Start Activity from processBA

warwound

Expert
Licensed User
Longtime User
I have a library class that is NOT an ActivityObject.

So this class is passed a process BA object and not an activity BA object when it is Initialized.

When this class has completed a task i want it to start an Activity within the B4A application that created an instance of the class.

I want the instance of the library class be a process global created in a code module.

I've experimented a bit but am lost!
Here's what i'm currently trying:

B4X:
Log.d("B4A", "Now start ShowGeographs Activity");

IntentWrapper intent=new IntentWrapper();
intent.Initialize(IntentWrapper.ACTION_MAIN, "");
intent.SetComponent(BA.packageName+"/._showgeographs");
mProcessBA.activity.startActivity(intent.getObject());

mProcessBA is the process BA object from the class Initialize method and i want to start my B4A project's 'ShowGeographs' Activity.

Ideally i'll use the native Android Intent class but have tried to use the B4A IntentWrapper here as so i could try some code examples from the forum.

I'd rather not make this class an Activity object and use raiseEvent to communicate back to my B4A project as it will contain a lot of downloaded and parsed JSON data that i want to be able to keep (and not destroy) on an orientation change.

Any ideas?

Martin.
 

stefanobusetto

Active Member
Licensed User
Longtime User
i need to create a wrapper of a button
in the java class i want to create an activity to be started
when the user clicks the button
i also need to be able to get some kind of result when the
started activity ends
and set the value of the caption of the button accordingly
you think your example may fit?
thanks
 

warwound

Expert
Licensed User
Longtime User
No what i needed to do will not help you start an activity and get a result from that activity.

I've successfully used the native Android Intent class to open a URL in a browser and to start the StreetView application but so far have had no need to get a result from the started activity.

What activity are you trying to get a result from?
Does that activity have any API type documentation?

Martin.
 

warwound

Expert
Licensed User
Longtime User
@martin
Thanks for the answer.
I have to write an activity not to use an exising one.
:)

You want to start an Activity that you will create yourself to get a result?

Can you give more details - what will the Activity do and what result data will it return?

Martin.
 

stefanobusetto

Active Member
Licensed User
Longtime User
tanks for your intrest in my problem
at last i'm able to post the details

my b4a application interacts with a web service
i need to fill a textedit (for example) with
data that are selected by the user from a huge list
so i'm writing a wrapped textedit
when the user clicks on it
i need to start an activity
where the user should be able to input same kind of data
the activity will then query the web service
passing the input as parameters
the web service will return a small subset of the huge list
and the user should be able to select one item from the list
the selected item will fill the textedit the user clicked
 
Last edited:

stefanobusetto

Active Member
Licensed User
Longtime User
@erel
at a first glance i'm not albe to figure out how to use your example
to solve my problem
but i have to study and understand the example well before
i can say it for sure

thanks
now i've something to start from
 
Top