Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

return onActivityResult, presenter getView() is null #35

Closed
jam0cam opened this issue Aug 5, 2015 · 4 comments
Closed

return onActivityResult, presenter getView() is null #35

jam0cam opened this issue Aug 5, 2015 · 4 comments

Comments

@jam0cam
Copy link

jam0cam commented Aug 5, 2015

Hi, Not sure if this is an issue, or I just don't know the correct way to handle this.

In my MainActivity, I fired: startActivityForResult()...
Then onActivityResult() comes back, and I do stuff with my presenter. getPresenter() is fine, but within my presenter, getView() returns null.

Some logging tells me this is the flow:

onResume
startActivityForResult
onPause
onActivityResult
onResume
....

Thanks,
Jia

@konmik
Copy link
Owner

konmik commented Aug 5, 2015

Hi! This is looks like the intended behavior for 1.3.3 but I'm going to change this for 2.0.0.

I will need to make some additional tests, probably tomorrow.

@konmik
Copy link
Owner

konmik commented Aug 6, 2015

So, I've made some tests.

  1. This is the intended behaviour for 1.3.3. In 1.3.3 Presenter is connected to the view only between onResume/onPause. So if you need to send something to the view you need to wait until it became available at onTakeView OR use RxPresenter's deliver capabilities.
  2. Right now I'm creating an update for 2.0.0 to make start/result scenario reliable even in the case of a process restart. This should work from 2.0.0-beta6, probably tomorrow.

@konmik
Copy link
Owner

konmik commented Aug 6, 2015

If you need to return some data from the presenter immediately then you can just create a function that returns a value in the presenter.

@jam0cam
Copy link
Author

jam0cam commented Aug 6, 2015

I ended up doing this and seems to work:

  protected void onActivityResult(int requestCode, int resultCode, Intent intent) {

                getPresenter().takeView(this);
                getPresenter().doXYZ();

    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants