Java Question onNewIntent

Johan Schoeman

Expert
Licensed User
Longtime User
I am doing a wrapper and the wrapper needs this @override method:

B4X:
    @Override
    protected void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        BA.Log("intent = " + intent);
        BA.Log("in onNewIntent");
        if (mNfcAdapter != null && mNfcAdapter.isEnabled()) {
            mCardNfcAsyncTask = new CardNfcAsyncTask.Builder(this, intent, mIntentFromCreate)
                    .build();
        }
    }

1. How should I accommodate/amend/modify the above code in wrapper without the wrapper having to extend Activity or AppCompatActivity?
2. Should I declare the wrapper as an @ActivityObject?

If the wrapper extends Activity then it "works" but this is probably not the correct way to do it.

Please help a dummy here.....

Thanks

JS
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Do what I do.
1. Open the generated source of Main.
2. Search for onnewintent.
3. You will see this code:
B4X:
    public void onNewIntent(android.content.Intent intent) {
        super.onNewIntent(intent);
        this.setIntent(intent);
        processBA.runHook("onnewintent", this, new Object[] {intent});
    }
This means that you can handle it with inline java: https://www.b4x.com/android/forum/threads/inline-java-code.50141/#content
 
Top