Created
May 13, 2017 14:58
-
-
Save parahall/2d366a83f64cc932425e0f66e3ba9098 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MainActivity extends AppCompatActivity implements MainActivityView { | |
@BindView(R.id.lv_am_movie_list) ListView listView; | |
@BindView(R.id.pb_am_loading) ProgressBar progressBar; | |
public static MainPresenter mainPresenter; | |
@Override protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
ButterKnife.bind(this); | |
listView.setVisibility(View.GONE); | |
progressBar.setVisibility(View.VISIBLE); | |
if (mainPresenter == null) { | |
mainPresenter = new MainPresenter(); | |
} | |
mainPresenter.attachView(this); | |
} | |
@Override protected void onDestroy() { | |
super.onDestroy(); | |
mainPresenter.detachView(); | |
if (isFinishing()) mainPresenter = null; | |
} | |
@Override public Context getAppContext() { | |
return getApplicationContext(); | |
} | |
@Override public Context getActivityContext() { | |
return this; | |
} | |
@Override public ListView getListView() { | |
return listView; | |
} | |
@Override public ProgressBar getProgressBar() { | |
return progressBar; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for your demonstrate.
Why do you add
if(isFinishing())
ononDestroy()
method?