How to pass an imageview that is in an Array List to another imageview in another activity

1

Activity 1 :

public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3)
    {
        //Pega o item que foi selecionado.
        ItemPromo item = adapterListView.getItem(arg2);
        //Demostração
        //Toast.makeText(this,item.getTexto(), Toast.LENGTH_LONG).show();
        Intent intent = new Intent(this,Promocao.class);
        intent.putExtra("valor1",item.getTexto());
        intent.putExtra("valor2",item.getIconeRid());
        startActivity(intent);
    }

Activity 2 :

 protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_promocao);

        lblTeste = (TextView) findViewById(R.id.lblTeste);
        imgTeste = (ImageView) findViewById(R.id.imgTeste);

        Bundle bundle = getIntent().getExtras();

        if(bundle.containsKey("valor1")){
            String valor = bundle.getString("valor1");
            lblTeste.setText(valor);
        }
        else if(bundle.containsKey("valor2")){
            int v = bundle.getInt("valor2");
            imgTeste.setImageAlpha(v);
        }

    }
    
asked by anonymous 08.11.2015 / 18:06

1 answer

1

Example:

Bundle extras = new Bundle();
extras.putParcelable("Bitmap", bmp);
intent.putExtras(extras);
startActivity(intent);

And in the second Activity:

Bundle extras = getIntent().getExtras();
Bitmap bmp = (Bitmap) extras.getParcelable("Bitmap");
    
08.11.2015 / 19:34