send image from one activity to another

后端 未结 2 1691
难免孤独
难免孤独 2021-01-26 00:22

I am trying to send an image from one activity to another but I dont know how to set the imageview.

here is how I send the image and other stuff

Intent i         


        
相关标签:
2条回答
  • 2021-01-26 00:57

    Dont you think

    img_view.setImageBitmap(intent.getByteArrayExtra("quantity"));
    

    should be

    img_view.setImageResource(intent.getIntExtra("name",R.drawable.default_image));
    
    0 讨论(0)
  • 2021-01-26 01:05

    use this code for get intent

    Intent intent = getIntent();
        ImageView img_view = (ImageView) findViewById(R.id.item_image);
        img_view.setBackgroundResource(intent.getIntExtra("name",1));
    
    0 讨论(0)
提交回复
热议问题