我的应用程序中有一个产品网格。当用户选择网格中的某个项目时,我会启动一个新的对话框活动,并显示该项目的名称、数量和图片。但是我无法动态地发送图像源。
这是我的代码:
gridView.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View v,int position, long id) {
//Toast.makeText(getApplicationContext(),((TextView) v.findViewById(R.id.grid_item_label)).getText(), Toast.LENGTH_SHORT).show();
Intent item_intent = new Intent(MainActivity.this, Item.class);
item_intent.putExtra("name",((TextView) v.findViewById(R.id.grid_item_label)).getText());
item_intent.putExtra("quantity",((TextView) v.findViewById(R.id.grid_item_quantity)).getText());
//my problem is here***************************************************
ImageView my_image = findViewById(R.id.grid_item_image).getDrawable();
item_intent.putExtra("image",my_image.getXXXXX());
//*********************************************************************
MainActivity.this.startActivity(item_intent);
}
});
我该使用什么方法从ImageView中获取图片源代码?