Shai Almog
Shai Almog

Reputation: 52770

How to invoke an Android Intent that expects a result from Codename One Native Code

How do I replace Android code that uses the onActivityResult functionality of native Android programming within a Codename One native class.

I can invoke a standard Activity in the code using:

AndroidNativeUtil.getActivity().startActivity(myIntent);

And importing:

import com.codename1.impl.android.AndroidNativeUtil;

But how do I get the result?

Upvotes: 2

Views: 185

Answers (1)

Shai Almog
Shai Almog

Reputation: 52770

You can use

AndroidNativeUtil.startActivityForResult(intent, new IntentResultListener() {
    public void onActivityResult (int requestCode, int resultCode, Intent data) {
         // your android native code here...
    }
});

Notice that your imports should now include:

import com.codename1.impl.android.AndroidNativeUtil;
import com.codename1.impl.android.IntentResultListener;

Upvotes: 1

Related Questions