private void initAdapter() {
   tadapter = new TabAdapter();
   viewPager.setAdapter(tadapter);
   viewPager.setOnPageChangeListener(new MyOnPageChangeListener());
   allAdapter = new ListAdapter(getActivity());
   myAdapter = new ListAdapter(getActivity());
 }
  @Override
  public void onHiddenChanged(boolean hidden) {
    super.onHiddenChanged(hidden);

    if (!hidden) {
      initActionBar();
    }

    if (!hidden) { // 仅当进入页面的时候作判断
      if (Utils.isLogon()) {
        rg_login.setVisibility(View.VISIBLE);
        viewPager.setScanScroll(true);
        viewPager.setCurrentItem(0);
        if (tadapter.mListViews.size() == 2) {
          myAdapter.pageNo = 1;
          myAdapter.list.clear();
          myAdapter.notifyDataSetChanged();
          queryMyAsk(myAdapter.pageNo, myAdapter, mpullToRefreshListview);
        } else {

          initMyList();
        }

      } else {
        rg_login.setVisibility(View.GONE);
        if (tadapter.mListViews.size() == 2) {
          viewPager.setScanScroll(false);
          viewPager.setCurrentItem(0);
        }
      }
    }
  }
 @OnClick(value = {R.id.rb_all, R.id.rb_my})
 private void onClick(View v) {
   switch (v.getId()) {
     case R.id.rb_all:
       viewPager.setCurrentItem(0);
       break;
     case R.id.rb_my:
       viewPager.setCurrentItem(1);
       break;
     default:
       break;
   }
 }
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle bundle) {
    view = super.onCreateView(inflater, container, bundle);
    initActionBar();
    initAdapter();

    initAllList();
    if (Utils.isLogon()) {
      rg_login.setVisibility(View.VISIBLE);
      viewPager.setScanScroll(true);
      viewPager.setCurrentItem(0);
      if (tadapter.mListViews.size() == 2) {
        myAdapter.pageNo = 1;
        myAdapter.list.clear();
        myAdapter.notifyDataSetChanged();
        queryMyAsk(myAdapter.pageNo, myAdapter, mpullToRefreshListview);
      } else {

        initMyList();
      }
    }
    return view;
  }
  private void initMyList() {

    View view;
    LayoutInflater inflater = LayoutInflater.from(getActivity());
    view = inflater.inflate(R.layout.view_pulltorefresh, null);
    tv_mempty = (TextView) view.findViewById(R.id.tv_empty);
    mpullToRefreshListview = (PullToRefreshListView) view.findViewById(R.id.pullToRefreshListview);

    mpullToRefreshListview.setMode(PullToRefreshListView.MODE_BOTH);

    mpullToRefreshListview.setAdapter(myAdapter);
    mpullToRefreshListview.setOnRefreshListener(
        new OnRefreshListener() {

          @Override
          public boolean onRefresh(int curMode) {
            if (curMode == PullToRefreshListView.MODE_PULL_DOWN_TO_REFRESH) {
              myAdapter.pageNo = 1;
              queryMyAsk(myAdapter.pageNo, myAdapter, mpullToRefreshListview);
            } else if (curMode == PullToRefreshListView.MODE_PULL_UP_TO_REFRESH) {
              myAdapter.pageNo++;
              queryMyAsk(myAdapter.pageNo, myAdapter, mpullToRefreshListview);
            }
            return false;
          }
        });
    mpullToRefreshListview.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Intent intent = new Intent(getActivity(), AskDetailActivity.class);
            intent.putExtra(BundleKeys.QUESTION_BEAN, myAdapter.list.get(position));
            startActivity(intent);
          }
        });

    queryMyAsk(myAdapter.pageNo, myAdapter, mpullToRefreshListview);

    tadapter.mListViews.add(view);
    tadapter.notifyDataSetChanged();
    viewPager.setCurrentItem(0);
  }