/** 清空我的菜单数据 */
  public void clearElecartList() {

    dbhelper.deleteAllData(DBHelper.ELE_CART_TM_NAME);

    Cursor ec = dbhelper.query(DBHelper.ELE_CART_TM_NAME);
    electrocartgoodslists = jmelecart.getElecarttoSQLite(ec);
    ec.close();
    // 提示菜单清楚
    String msg = "您的菜单已被删除";
    Toast t = Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_LONG);
    t.show();
  }
 /** 隐重新计算elecart内容 */
 public void calnewElecartListView() {
   electrocartgoodslists.clear();
   // 读取ele_cart缓存
   Cursor ec = dbhelper.query(DBHelper.ELE_CART_TM_NAME);
   electrocartgoodslists = jmelecart.getElecarttoSQLite(ec);
   ec.close();
   Context mContext = YooxiCoffeeGoodsDetail.this;
   LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(LAYOUT_INFLATER_SERVICE);
   final View alertCartlist = inflater.inflate(R.layout.yooxicafe_alertlist, null);
   listViewForCart = (ListView) alertCartlist.findViewById(R.id.yooxicartlistview); // 我的菜单listview
   listViewForCart.setAdapter(
       new JshopMyElecartListViewAdapter(electrocartgoodslists, this.getApplicationContext()));
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    super.requestWindowFeature(Window.FEATURE_NO_TITLE); // 设置无标题窗口
    super.getWindow()
        .setFlags(
            WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN); // 全屏模式
    super.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); // 强制为横屏
    this.setContentView(R.layout.yooxicafe_goodslist);
    Intent intent = this.getIntent();
    String goodsid = intent.getStringExtra("goodsid");
    Cursor c = dbhelper.queryByParamgoodsid(dbhelper.GOODS_TM_NAME, goodsid);
    try {
      goodslists = jmGoodsListAction.getGoodsListSQLiteNoZip(c);
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    c.close();
    if (!goodslists.isEmpty()) {
      holder.setGoodsimage((ImageView) this.findViewById(R.id.goodsimage));
      holder.setGoodsname((TextView) this.findViewById(R.id.goodsname));
      holder.setWeight((TextView) this.findViewById(R.id.valueweight));
      holder.setUnitname((TextView) this.findViewById(R.id.unitname));
      holder.setMemberprice((TextView) this.findViewById(R.id.memberprice));
      holder.setDetail((TextView) this.findViewById(R.id.goodsdetail));

      holder.getGoodsimage().setImageBitmap((Bitmap) goodslists.get(0).get("pictureurl"));
      holder.getGoodsname().setText(goodslists.get(0).get("goodsname").toString());
      holder.getMemberprice().setText(goodslists.get(0).get("memberprice").toString());
      holder.getUnitname().setText(goodslists.get(0).get("unitname").toString());
      holder.getWeight().setText(goodslists.get(0).get("weight").toString());
    }

    // 处理返回事件响应
    getback = (TextView) this.findViewById(R.id.getback);
    getback.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            finish();
          }
        });

    // 处理加入餐车事件
    countplus = (TextView) this.findViewById(R.id.countplus);
    countplus.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            addtoCart(goodslists, 0);
          }
        });

    // 查看已选
    checkselected = (TextView) this.findViewById(R.id.checkselected);
    checkselected.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            setElecartListView();
          }
        });
  }
  /** 读取我的菜单数据 */
  public void setElecartListView() {
    electrocartgoodslists.clear();
    // 读取ele_cart缓存
    Cursor ec = dbhelper.query(DBHelper.ELE_CART_TM_NAME);
    electrocartgoodslists = jmelecart.getElecarttoSQLite(ec);
    ec.close();
    /** 构建弹出框 */
    AlertDialog.Builder builder;
    Context mContext = YooxiCoffeeGoodsDetail.this;
    LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(LAYOUT_INFLATER_SERVICE);
    final View alertCartlist = inflater.inflate(R.layout.yooxicafe_alertlist, null);
    listViewForCart = (ListView) alertCartlist.findViewById(R.id.yooxicartlistview); // 我的菜单listview
    builder = new AlertDialog.Builder(mContext);
    listViewForCart.setAdapter(
        new JshopMyElecartListViewAdapter(electrocartgoodslists, this.getApplicationContext()));
    // 初始化控件
    TextView confirm = (TextView) alertCartlist.findViewById(R.id.confirm);
    TextView clearall = (TextView) alertCartlist.findViewById(R.id.clearall);
    // 计算总价
    total = 0.0;
    if (!electrocartgoodslists.isEmpty()) {
      for (int i = 0; i < electrocartgoodslists.size(); i++) {
        total =
            Arith.add(
                total,
                Arith.mul(
                    Double.parseDouble(electrocartgoodslists.get(i).get("memberprice").toString()),
                    Double.parseDouble(
                        electrocartgoodslists.get(i).get("needquantity").toString())));
      }
      TextView countmoney = (TextView) alertCartlist.findViewById(R.id.countmoney);
      countmoney.setText("¥" + total);
    } else {
      TextView countmoney = (TextView) alertCartlist.findViewById(R.id.countmoney);
      countmoney.setText("¥" + total);
    }
    builder.setTitle("已点清单").setView(alertCartlist);
    final AlertDialog alert = builder.create();
    alert.show();
    // confirm事件响应
    confirm.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            alert.dismiss();
          }
        });
    // 清空菜单clearall
    clearall.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            clearList();
            alert.dismiss();
          }
        });
  }