2014-03-19 79 views
1

我从Web服务获取值并填充textviews,并且我还在某些值上设置了标签,因为我必须在按钮单击时将这些值发送到其他活动上。但我只获取数组的最后一个值。gettag()只获取数组的最后一个索引值

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); 

          } 
         }); 

回答

1

我固定我的代码以这样的:

OnClick方法,改变了我的代码

ImageView iv = (ImageView)v; 
ProductURL = (String) iv.getTag(); 
相关问题