@Override protected void onDestroy() { super.onDestroy(); if (mLocationClient != null) { mLocationClient.stop(); mLocationClient = null; } }
@Override protected void onStop() { ((App) getApplication()).onLocListeners.remove(this); if (mLocationClient != null) { mLocationClient.stop(); } super.onStop(); }
@Override public void requestDataRefresh() { if (cityId != -1) { super.requestDataRefresh(); } else { page = 1; presenter.getData(_cityName, _Lat + "", _Lng + "", page, count); } }
@Override public void loadMore() { if (cityId != -1) { super.loadMore(); } if (adapter.getStatus() == BaseAdapter.STATUS_HASMORE) { page++; presenter.getData(_cityName, _Lat + "", _Lng + "", page, count); adapter.loading(); } }
/** @param savedInstanceState */ @Override protected void initThings(Bundle savedInstanceState) { super.initThings(savedInstanceState); mLocationClient = new LocationClient(getApplicationContext()); // 声明LocationClient类 mLocationClient.registerLocationListener(myListener); // 注册监听函数 tvTitle.setText("定位中..."); showDialog("提示", "正在定位..."); initLocation(); mLocationClient.start(); tvTitle.setText(_cityName); presenter.getData(_cityName, _Lat + "", _Lng + "", page, count); }
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == C.RESULT_ONE && requestCode == C.REQUEST_SELECT_CATE) { if (data != null) { Bundle bun = data.getBundleExtra("data"); if (bun != null) { name = bun.getString("name"); id = bun.getInt("id"); tvTitle.setText(name); page = 1; cityId = id; presenter.getData(page, count); } } } else if (resultCode == C.RESULT_TWO) { tvTitle.setText(_cityName); cityId = -1; presenter.getData(_cityName, _Lat + "", _Lng + "", page, count); } }
@Override protected void onStart() { super.onStart(); ((App) getApplication()).onLocListeners.add(this); }