0

I would like to put all my Intent calls in a separate class than my main Activity class for organization purposes. Easy enough.

import android.app.Activity; import android.content.Intent; public class IntentCalls { Activity activity; IntentCalls(Activity activity) { this.activity = activity; } public void startIntent() { ... activity.startActivityForResult(intent, _int); } } 

So, I'll be able to call startIntent() from my main Activity... But How can I set up an onActivityResult method in this class without making it an Activity? Is this possible?

1 Answer 1

1

I believe your onActivityResult() method will be invoked in the activity you are passing to the constructor. So you still need to implement (override) the onActivityResult() method in the original activity. This class that you are creating is like a macro really – a convenience. From my experience I would discourage you from doing this and moving out something as trivial as this.

Sign up to request clarification or add additional context in comments.

1 Comment

Yeah, it's probably more trouble than it's worth.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.