Mortar-Flow-Dagger2-demo
Mortar-Flow-Dagger2-demo copied to clipboard
Calling specific callbacks that take Activity as parameter
Hi Lukas,
First of all, thanks for the outstanding job that you have been doing ! I have a question, I've checked out this example and I'm trying to login using FB login. The problem is, inside my view I have a button callback that must call 'LoginManager.getInstance().logInWithReadPermissions(activity, permissions);'
How can I accomplish this ? Thanks for your time !
Hi!
You need to create a link between the activity and the views/presenters.
The class that represents that link, which could be called ActivityPresenter
or ActivityOwner
, will be linked to the activity on the activity's onCreate()
and unlinked in the activity's onDestroy()
. You can then pass that activity owner to the views/presenters, either by adding it as a service of the mortar scope, or by dagger2.
You can find more info on that SO post: http://stackoverflow.com/questions/21927990/mortar-flow-with-third-party-libraries-hooked-to-activity-lifecycle