コード例 #1
0
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {

    if (savedInstanceState != null) {
      userBean = (UserBean) savedInstanceState.getSerializable("userBean");
      accountBean = (AccountBean) savedInstanceState.getSerializable("account");
      token = savedInstanceState.getString("token");

      hashMap = (HashMap) savedInstanceState.getSerializable("hashmap");
      selectedId = savedInstanceState.getString("selectedId");

      clearAndReplaceValue((MessageListBean) savedInstanceState.getSerializable("bean"));
      timeLineAdapter.notifyDataSetChanged();

      refreshLayout(bean);
    } else {
      if (dbTask == null || dbTask.getStatus() == MyAsyncTask.Status.FINISHED) {
        dbTask = new DBCacheTask();
        dbTask.executeOnExecutor(MyAsyncTask.THREAD_POOL_EXECUTOR);
      }

      hashMap.put("0", new MessageListBean());
      hashMap.put("1", new MessageListBean());
    }

    super.onActivityCreated(savedInstanceState);

    groupTask = new GroupTask();
    groupTask.executeOnExecutor(MyAsyncTask.THREAD_POOL_EXECUTOR);
  }
コード例 #2
0
  @Override
  public void onDetach() {
    super.onDetach();

    if (dbTask != null) dbTask.cancel(true);

    if (groupTask != null) groupTask.cancel(true);
  }