我在我的應用程序中使用自定義列表視圖。在我的行中我有(兩個圖像,剩下的textviews)。如何獲得選定行的列表視圖的小部件ID
當我點擊TextView的之一,我想設置另一個TextView的data.I寫了下面的代碼來做到這一點
likes.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// if(likes.getText().toString().equals("Like")){
TextView t=(TextView)v;
TextView likesnumber1 = (TextView) findViewById(R.id.likesnumber);
// TextView likesnumber = (TextView) convertView.findViewById(R.id.likesnumber);
int i= Integer.parseInt(likescount.get(position));
if(like_or_ulike.get(position).equals("Like")){
Log.e("inlike","like");
like_or_ulike.set(position, "Unlike");
t.setText(like_or_ulike.get(position));
UrltoValue.getValuefromUrl("https://graph.facebook.com/"+objectid.get(position)+"/likes?access_token="+accesstoken+"&method="+"post");
// listView.getAdapter().getItemAt(position);
j=i+1;
String s=Integer.toString(j);
likescount.set(position, s);
likesnumber1.setText(likescount.get(position));
}
else{
Log.e("unlike","unlike");
like_or_ulike.set(position, "Like");
t.setText(like_or_ulike.get(position));
UrltoValue.getValuefromUrl("https://graph.facebook.com/"+objectid.get(position)+"/likes?access_token="+accesstoken+"&method="+"DELETE");
j=i-1;
String s=Integer.toString(j);
likescount.set(position, s);
likesnumber1.setText(likescount.get(position));
}
}
});
我怎樣才能得到特定行的另一TextView的ID當我點擊textview.Is有可能獲得該特定行的ID。
是你想要在同一行的文本視圖?或不同? –
我想要同樣的行的textview id,即likescount id,當我點擊時,因爲我想設置值。 – veerendra