下面是圖像適配器。當我點擊它時,我分配了setOnClickListener
,我開始了新活動的新意圖,但是我想在此適配器中將此圖像發送給其他活動並將其設置爲圖像視圖。我的問題是我不知道如何將viewholder.image
轉移到位圖並通過意向發送。 how to that如何發送imageview與意圖?
View row = convertView;
final ViewHolder holder;
if (row == null) {
LayoutInflater inflater = LayoutInflater.from(mcontext);
row = inflater.inflate(layoutResourceId, parent, false);
holder = new ViewHolder();
holder.imageTitle = (TextView) row.findViewById(R.id.text);
holder.imageView = (ImageView) row.findViewById(R.id.imageView);
row.setTag(holder);
} else {
holder = (ViewHolder) row.getTag();
}
Listitem item = getItem(position);
System.out.println("item.getUrl() ");
System.out.println(item.getUrl());
holder.imageTitle.setText(item.getId());
Picasso.
with(mcontext).
load(item.getUrl())
.placeholder(R.drawable.logo)
.fit()
.into(holder.imageView);
holder.imageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Log.d("OnImageButton", "Clicked");
Intent intnt =new Intent(mcontext, SingleViewActivity.class);
Bitmap imageID=holder.imageView; // error here
intnt.putExtra("ImageId", imageID);
mcontext.startActivity(intnt) ;
Toast.makeText(mcontext, "intent",
Toast.LENGTH_LONG).show();
}
});
return row;
}
static class ViewHolder {
TextView imageTitle;
ImageView imageView;
}
請參閱我的回答http://stackoverflow.com/questions/32131605/how-移動圖像捕獲的手機相機從一個活動的圖像v/32132186#32132186看看它是否可以幫助你或不 – BNK
@ bnk我沒有解決這個問題,但感謝reinmandation – Moudiz