@Override protected void onRestart() { // TODO Auto-generated method stub super.onRestart(); count = 1; data = new ArrayList<NoticeItem>(); try { HLog.out(TAG, data.size()); } catch (Exception e) { e.printStackTrace(); } loadingData(); // 更新数据 }
@Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.find_sqqz_list); ViewUtils.inject(this); mActivity = this; data = new ArrayList<NoticeItem>(); mBitmapUtils = new BitmapUtils(mActivity); data = new ArrayList<NoticeItem>(); mUser = DbOperation.getUser(mActivity); if (mUser == null) { Utils.Toast(mActivity, "温馨提示:", "登录已过期,请重新登录!"); Utils.goToUserLogin(mActivity); } if (data.size() == 0) { myProgressDialog = new MyProgressDialog(mActivity, "加载数据中...", false); myProgressDialog.show(); loadingData(); // 加载数据 } mPullRefreshListView.setMode(Mode.PULL_UP_TO_REFRESH); mPullRefreshListView.setOnRefreshListener( new OnRefreshListener<ListView>() { @Override public void onRefresh(PullToRefreshBase<ListView> refreshView) { String label = DateUtils.formatDateTime( mActivity, System.currentTimeMillis(), DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_ABBREV_ALL); if (mPullRefreshListView.isFooterShown()) { refreshView.getLoadingLayoutProxy().setLastUpdatedLabel("加载更多"); loadingData(); } } }); ListView actualListView = mPullRefreshListView.getRefreshableView(); registerForContextMenu(actualListView); mAdapter = new MyAdapter(); actualListView.setAdapter(mAdapter); }