如何將圖像res發送到另一個活動 - 如何將資源更改爲整數? 我創建類圖片資源傳遞到另一個活動:發送圖像到另一個活動 - 如何將資源更改爲整數?
公共類MyImageView延伸的ImageView實現View.OnClickListener {
Context contxt;
public MyImageView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
setOnClickListener(this);
this.contxt = context;
}
public MyImageView(Context context, AttributeSet attrs) {
super(context, attrs);
setOnClickListener(this);
this.contxt = context;
}
public MyImageView(Context context) {
super(context);
setOnClickListener(this);
this.contxt = context;
}
@Override
public void setOnClickListener(OnClickListener l) {
super.setOnClickListener(l);
}
@Override
public void onClick(View v) {
int g = getResourse......................;(this is my peroblem)
Bundle extras = new Bundle();
extras.putInt("imagebitmap", g);
Intent i = new Intent(contxt, zara.knauf.Img.class);
i.putExtras(extras);
contxt.startActivity(i);
}
}
你拼寫錯誤RESOUR ** C ** E要RESOUR計劃** S **如我不知道它是否有幫助,但可能會在代碼中產生問題。無論如何,simlpy通過** id **並在被調用的活動中檢索資源** c ** e。 DONE。 –
[這裏你可以找到你的答案。](https://stackoverflow.com/questions/11519691/passing-image-from-one-activity-another-activity)這已經解決了希望這會幫助你。 –
@Ifran這不是傳遞資源ID –