【问题标题】:gettag() is getting only last index value of an arraygettag() 只获取数组的最后一个索引值
【发布时间】:2014-03-19 06:48:44
【问题描述】:

我从 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);    
 }
});

【问题讨论】:

    标签: android arrays tags


    【解决方案1】:

    我用这个修复了我的代码:

    OnClick 方法,将我的代码更改为

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-02-16
      • 1970-01-01
      • 2021-12-03
      • 1970-01-01
      • 2014-09-27
      • 2014-05-09
      • 2017-06-21
      • 2021-12-27
      相关资源
      最近更新 更多