Reputation: 323
I have an android ANE, and when the ANE initializes I start a new CustomActivity (extends Activity) which has all my custom logic for the ANE.
This is how I start the activity in my CustomExtensionContext (extends FREContext) class :
Intent intent = new Intent(getActivity().getApplicationContext(), CustomActivity.class);
getActivity().startActivity(intent);
Now, in my CustomAcivity, I have some other public methods which I want to call through my as3 code. I have created FREFunction classes and have added these functions to the HashMap. And I know how I can call the function from the as3 side.
What i dont know is, how to call some public method of CustomActivity class from my CustomExtensionContext, as I dont have any reference to its object ??!!
(new to Android, I am an AS3 developer)
Thanks
Upvotes: 0
Views: 163
Reputation: 323
Technically I dont think this is the right answer, BUT this is how I solved my problem of accessing public function of the CustomActivity class.
I created a public static instance variable in the CustomActivity class of type CustomActivity and called
myStaticCustomActivityInstance = this;
in the onCreate and onResume function.
Then where ever I want access to this class's functions I can simply type :
if(CustomActivity.myStaticCustomActivityInstance != null)
{
CustomActivity.myStaticCustomActivityInstance.somePublicFunction();
}
Upvotes: 0