私はArrayAdapter ImageViewの中に置かれている]をクリックしてArrayAdapterからIDを取得する方法を、リストには次のようになりますアンドロイドはImageViewの
名前2 | ImageView |
名前3 | ImageView |
終わりそう..に
私はImageViewのをクリックした後にアイテムIDを取得する方法がわかりません。
@Override
public View getView(int position, View contextView, ViewGroup parent) {
final ViewHolder viewHolder;
View rowView = contextView;
final CardList list = _cardList.get(position);
if (rowView == null) {
LayoutInflater layoutInflater = _context.getLayoutInflater();
rowView = layoutInflater.inflate(R.layout.cardlist_viewlist_tpl, null, true);
viewHolder = new ViewHolder();
viewHolder.tvCardListName = (TextView) rowView.findViewById(R.id.tvCardListName);
viewHolder.btnCardListLearn = (ImageView) rowView.findViewById(R.id.btnCardListLearn);
viewHolder.btnCardListLearn.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
Intent intent = new Intent(_context, LearningCardActivity.class);
//!!!!!!!!!!!!!!!
//this doesn't work, I always get 1st positon Id
intent.putExtra(LearningCardActivity.CURRENT_CARD_LIST_ID, list.getId());
//!!!!!!!!!!!!!!!!
_context.startActivity(intent);
}
});
rowView.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) rowView.getTag();
}
viewHolder.tvCardListName.setText(list.getName());
return rowView;
}