@Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.tab_youhuiquan);
    //		dialog =new MyProcessDialog(YouHuiQuanActivity.this);
    myApp = (MyApp) YouHuiQuanActivity.this.getApplication();
    listview = (PullView) findViewById(R.id.listview);
    moreView = getLayoutInflater().inflate(R.layout.list_more_load, null);
    adapter = new YouHuiQuanListViewAdapter(YouHuiQuanActivity.this);
    youhuiquan_list = new ArrayList<YouHuiQuanList>();
    listview.setAdapter(adapter);
    adapter.notifyDataSetChanged();
    listview.setOnScrollListener(this); // 设置listview的滚动事件

    ListViewInFo(pageno = 1);

    expandTabView = (ExpandTabView) findViewById(R.id.expandtab_view);
    viewMiddle = new ViewMiddle(this);
    view_l = new ViewMiddle(this);
    view_r = new ViewMiddle(this);

    mViewArray.add(viewMiddle);
    mViewArray.add(view_l);
    mViewArray.add(view_r);
    mTextArray.add("全部地区");
    mTextArray.add("全部分类");
    mTextArray.add("默认排序");
    expandTabView.setValue(mTextArray, mViewArray);

    viewMiddle.setOnSelectListener(
        new ViewMiddle.OnSelectListener() {

          @Override
          public void getValue(String showText) {

            onRefresh(viewMiddle, showText);
          }
        });
    listview.setonRefreshListener(
        new OnRefreshListener() {
          @Override
          public void onRefresh() {
            listview.removeFooterView(moreView);
            ListViewInFo(pageno = 1);
          }
        });
    listview.setOnItemClickListener(
        new OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
            YouHuiQuanList you = (YouHuiQuanList) listview.getItemAtPosition(arg2);
            Intent intent = new Intent(YouHuiQuanActivity.this, YouHuiQuanDetalisActivity.class);
            intent.putExtra("coupon_id", you.getCoupon_id() + "");
            YouHuiQuanActivity.this.startActivity(intent);
          }
        });
  }
 @Override
 public void onScrollStateChanged(AbsListView view, int scrollState) {
   // 下拉到空闲是,且最后一个item的数等于数据的总数时,进行更新
   if (lastItem == listview.getCount() - 1 && scrollState == this.SCROLL_STATE_IDLE) {
     if (list_flag) {
     } else {
       mHandler.sendEmptyMessage(0);
     }
   }
 }
 @Override
 protected void onResume() {
   super.onResume();
   //		if(flag !=null && !flag.equals("0") && !flag.equals("")
   //				&& !myApp.getCity_id().equals(flag)){
   //			listview.addFooterView(moreView);
   //			youhuiquan_list.clear();
   //			adapter.notifyDataSetChanged();
   //			ListViewInFo(1);
   //		}
   if (!myApp.getCity_id().equals(flag) && !myApp.getCity_id().equals("0")) {
     listview.addFooterView(moreView);
     youhuiquan_list.clear();
     adapter.notifyDataSetChanged();
     ListViewInFo(1);
   }
 }
 public void ListViewInFo(int pangeno) {
   //		dialog.show();
   if (myApp.getCity_id() == null
       || myApp.getCity_id().equals("0")
       || myApp.getCity_id().equals("")) {
     //			dialog.dismiss();
     Toast.makeText(YouHuiQuanActivity.this, "城市没有获取到,请稍后重试", Toast.LENGTH_SHORT).show();
     listview.removeFooterView(moreView);
     listview.onRefreshComplete();
     return;
   }
   flag = myApp.getCity_id();
   String url =
       Constants.URL_COUPON_LIST
           + "&city_id="
           + myApp.getCity_id()
           + "&pagenumber="
           + pangeno
           + "&pagesize="
           + Constants.PARAM_PAGESIZE;
   RemoteDataHandler.asyncGet(
       url,
       new Callback() {
         @Override
         public void dataLoaded(ResponseData data) {
           //				dialog.dismiss();
           listview.onRefreshComplete();
           if (data.getCode() == HttpStatus.SC_OK) {
             String json = data.getJson();
             //					if(data.getCount() <= pageno * Constants.PARAM_PAGESIZE){
             //						list_flag=true;
             //						listview.removeFooterView(moreView);
             //					}else{
             //						list_flag=false;
             //						moreView.setVisibility(View.VISIBLE);
             //					}
             int count = 0;
             if (pageno == 1) {
               youhuiquan_list.clear();
               adapter.notifyDataSetChanged();
             } else {
               count = ((pageno - 1) * Constants.PARAM_PAGESIZE);
             }
             listview.setSelection(count);
             if (data.isHasMore()) {
               list_flag = false;
               listview.addFooterView(moreView);
             } else {
               list_flag = true;
               listview.removeFooterView(moreView);
             }
             ArrayList<YouHuiQuanList> list = YouHuiQuanList.newInstanceList(json);
             youhuiquan_list.addAll(list);
             adapter.setDatas(youhuiquan_list);
             adapter.notifyDataSetChanged();
           } else {
             listview.removeFooterView(moreView);
             listview.onRefreshComplete();
             Toast.makeText(YouHuiQuanActivity.this, "加载优惠券列表失败,请稍后重试", Toast.LENGTH_SHORT).show();
           }
         }
       });
 }