Android, How to pass the name of int variable to a popupwindow?

How can I pass the name of an int variable to a popupwindow when an image is clicked? I have set an int per image and I have a lot of images that I had set. This is how I'm using the int in a textView on a PopupWindow. public boolean onLongClick(View v) { // v.setTag(v); case R.id.hsv1iv1: ImageView ivpopup = (ImageView) popupView.findViewById(R.id.pv1); intcount1++; // I would like to pass this int name to the popup window. break; case R.id.hsv2iv1: ImageView ivpopup = (ImageView) popupView.findViewById(R.id.pv1); intcount2++; // I would like to pass this int name to the popup window. break; LayoutInflater layoutInflater = (LayoutInflater)getBaseContext() .getSystemService(LAYOUT_INFLATER_SERVICE); View popupView = layoutInflater.inflate(R.layout.popup, null); final PopupWindow popupWindow = new PopupWindow( popupView, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); popupWindow.update(0, 0, 800, 500); ColorDrawable dw = new ColorDrawable(-005500); popupWindow.setBackgroundDrawable(dw); tvpwlikectr = (TextView) popupView.findViewById(R.id.liketv); Button pwlikebtn = (Button) popupView.findViewById(R.id.pwlikebtn); Button btnDismiss = (Button)popupView.findViewById(R.id.cancel); pwlikebtn.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { intcount1++; tvpwlikectr.setText(Integer.toString(intcount1)); // this code doesn't work with the intcount1 }}); btnDismiss.setOnClickListener(new Button.OnClickListener(){ public void onClick(View v) { popupWindow.dismiss(); popupWindow.setTouchable(true); popupWindow.setFocusable(true); popupWindow.setOutsideTouchable(true); } }

以上就是Android, How to pass the name of int variable to a popupwindow?的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏