Android Question

How to take and put image from one ImageView to another

I want to take picture from second activity imageView and put it in MainActivity imageView. How to put it? Hope my code of taking it is right.

Main Activity

protected void onActivityResult(int requestCode, int resultCode, Intent data) {

if (resultCode == RESULT_OK) {
switch (requestCode) {
case REQUEST_CODE_PLAYER1:
String name1 = data.getStringExtra("name");
playerName1.setText(name1);
btnPlayer1.setImageResource(Integer.parseInt("photo"));


Second Activity

public void onClick(View v) {

Intent intent = new Intent();
switch (v.getId()) {
case R.id.axe:
intent.putExtra("name", axeName.getText().toString());
intent.putExtra("photo", R.drawable.axe);
break;

Answer Source

Yo can get Image like.

 btnPlayer1.setImageResource(data.getIntExtra("photo",0));
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download