Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/227.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android gettag()只获取数组的最后一个索引值_Android_Arrays_Tags - Fatal编程技术网

Android gettag()只获取数组的最后一个索引值

Android gettag()只获取数组的最后一个索引值,android,arrays,tags,Android,Arrays,Tags,我从web服务获取值并填充它textviews,我还在一些值上设置标记,因为我必须通过单击按钮将这些值发送到其他活动。但我只得到数组的最后一个值 txt_TransStatus.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub TextView cr = (TextView) chi

我从web服务获取值并填充它
textviews
,我还在一些值上设置标记,因为我必须通过单击按钮将这些值发送到其他活动。但我只得到数组的最后一个值

txt_TransStatus.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {
    // TODO Auto-generated method stub

    TextView cr = (TextView) child.findViewById(R.id.txt_StatusValue);
    TextView pid = (TextView) child.findViewById(R.id.txt_DateValue);
    TextView amount = (TextView) child.findViewById(R.id.txt_RechargeAmountValue);
    TextView phone = (TextView) child.findViewById(R.id.txt_PhoneValue);
    TextView pin = (TextView) child.findViewById(R.id.txt_PinNumberValue);

    Intent intent = new Intent(con, GetTransData.class);
    intent.putExtra("CRID", cr.getTag().toString());
    intent.putExtra("PID", pid.getTag().toString());
    intent.putExtra("Amount", amount.getTag().toString());
    intent.putExtra("Phone", phone.getTag().toString());
    intent.putExtra("PINNum", pin.getTag().toString());
    con.startActivity(intent);    
 }
});

我用以下代码修复了我的代码:

OnClick方法,将代码更改为

ImageView iv = (ImageView)v;
ProductURL = (String) iv.getTag();