@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); menu.add(Menu.NONE, MENU_REFRESH, Menu.NONE, R.string.refresh) .setIcon(R.drawable.ic_menu_refresh); menu.add(Menu.NONE, MENU_EXIT, Menu.NONE, R.string.preferences_exit_title); return true; }
@Override public void onPause() { super.onPause(); ((Jianjianroid) getApplication()).removeLocationUpdates(); if (isFinishing()) { if (mListAdapter != null) { mListAdapter.removeObserver(); } unregisterReceiver(mLoggedOutReceiver); mStateHolder.cancel(); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); registerReceiver(mLoggedOutReceiver, new IntentFilter(Jianjianroid.INTENT_ACTION_LOGGED_OUT)); if (getLastNonConfigurationInstance() != null) { mStateHolder = (StateHolder) getLastNonConfigurationInstance(); mStateHolder.setActivity(this); } else { mStateHolder = new StateHolder(); mStateHolder.setSortMethod(SORT_METHOD_RECENT); } ensureUi(); Jianjianroid mJianjianroid = (Jianjianroid) getApplication(); if (mJianjianroid.isReady()) { if (!mStateHolder.getRanOnce()) { mStateHolder.startTask(this); } } }
@Override public void onResume() { super.onResume(); ((Jianjianroid) getApplication()).requestLocationUpdates(true); }