{"action":"created","issue":{"url":"https://api.github.com/repos/MindorksOpenSource/android-mvp-architecture/issues/41","repository_url":"https://api.github.com/repos/MindorksOpenSource/android-mvp-architecture","labels_url":"https://api.github.com/repos/MindorksOpenSource/android-mvp-architecture/issues/41/labels{/name}","comments_url":"https://api.github.com/repos/MindorksOpenSource/android-mvp-architecture/issues/41/comments","events_url":"https://api.github.com/repos/MindorksOpenSource/android-mvp-architecture/issues/41/events","html_url":"https://github.com/MindorksOpenSource/android-mvp-architecture/issues/41","id":258711305,"number":41,"title":"How to call a Method that located in Fragment from its Presenter?!","user":{"login":"Drjacky","id":2296754,"avatar_url":"https://avatars2.githubusercontent.com/u/2296754?v=4","gravatar_id":"","url":"https://api.github.com/users/Drjacky","html_url":"https://github.com/Drjacky","followers_url":"https://api.github.com/users/Drjacky/followers","following_url":"https://api.github.com/users/Drjacky/following{/other_user}","gists_url":"https://api.github.com/users/Drjacky/gists{/gist_id}","starred_url":"https://api.github.com/users/Drjacky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Drjacky/subscriptions","organizations_url":"https://api.github.com/users/Drjacky/orgs","repos_url":"https://api.github.com/users/Drjacky/repos","events_url":"https://api.github.com/users/Drjacky/events{/privacy}","received_events_url":"https://api.github.com/users/Drjacky/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-09-19T06:38:18Z","updated_at":"2017-09-19T07:04:19Z","closed_at":"2017-09-19T07:04:19Z","author_association":"NONE","body":"AboutMvpView:\r\n\r\n```\r\nPublic interface AboutMvpView extends MvpView {\r\n    void loadUserList();\r\n}\r\n```\r\nAboutFragment:\r\n```\r\npublic class AboutFragment extends BaseFragment implements AboutMvpView {\r\n...\r\n    @Nullable\r\n    @Override\r\n    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,\r\n                             @Nullable Bundle savedInstanceState) {\r\n        View view = inflater.inflate(R.layout.fragment_about, container, false);\r\n\r\n        getActivityComponent().inject(this);\r\n\r\n        setUnBinder(ButterKnife.bind(this, view));\r\n\r\n        mPresenter.onAttach(this);\r\n\r\n        mPresenter.onTest();//////////////////\r\n\r\n        return view;\r\n    }\r\n\r\n    @Override\r\n    public void loadUserList() {\r\n        Toast.makeText(getActivity(),\"onTest\",Toast.LENGTH_LONG).show();\r\n    }\r\n}\r\n```\r\nAboutPresenter:\r\n```\r\npublic class AboutPresenter<V extends AboutMvpView> extends BasePresenter<V>\r\n        implements AboutMvpPresenter<V> {\r\n    V mView;\r\n\r\n    @Inject\r\n    public AboutPresenter(DataManager dataManager, CompositeDisposable compositeDisposable) {\r\n        super(dataManager, compositeDisposable);\r\n        mView = getMvpView(); // What should we write here?!\r\n    }\r\n\r\n    @Override\r\n    public void onTest() {\r\n         mView.loadUserList(); //It's null!\r\n/*java.lang.NullPointerException: Attempt to invoke interface method 'void com.mindorks.framework.mvp.ui.about.AboutMvpView.loadUserList()' on a null object reference*/\r\n    }\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/MindorksOpenSource/android-mvp-architecture/issues/comments/330449089","html_url":"https://github.com/MindorksOpenSource/android-mvp-architecture/issues/41#issuecomment-330449089","issue_url":"https://api.github.com/repos/MindorksOpenSource/android-mvp-architecture/issues/41","id":330449089,"user":{"login":"Drjacky","id":2296754,"avatar_url":"https://avatars2.githubusercontent.com/u/2296754?v=4","gravatar_id":"","url":"https://api.github.com/users/Drjacky","html_url":"https://github.com/Drjacky","followers_url":"https://api.github.com/users/Drjacky/followers","following_url":"https://api.github.com/users/Drjacky/following{/other_user}","gists_url":"https://api.github.com/users/Drjacky/gists{/gist_id}","starred_url":"https://api.github.com/users/Drjacky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Drjacky/subscriptions","organizations_url":"https://api.github.com/users/Drjacky/orgs","repos_url":"https://api.github.com/users/Drjacky/repos","events_url":"https://api.github.com/users/Drjacky/events{/privacy}","received_events_url":"https://api.github.com/users/Drjacky/received_events","type":"User","site_admin":false},"created_at":"2017-09-19T07:04:19Z","updated_at":"2017-09-19T07:04:19Z","author_association":"NONE","body":"Solved.\r\nAboutPresenter:\r\n```\r\npublic class AboutPresenter<V extends AboutMvpView> extends BasePresenter<V>\r\n        implements AboutMvpPresenter<V> {\r\n\r\n    @Inject\r\n    public AboutPresenter(DataManager dataManager, CompositeDisposable compositeDisposable) {\r\n        super(dataManager, compositeDisposable);\r\n    }\r\n\r\n    @Override\r\n    public void onTest() {\r\n         getMvpView().loadUserList(); //HERE\r\n    }\r\n}\r\n```"}}
{"actor":{"display_login":"Drjacky"}}