Passing an image from one activity to other activity

前端 未结 3 1332
礼貌的吻别
礼貌的吻别 2020-12-18 16:21

I am trying to pass an image which is from the mobile media. I am able to get the image from the media but I need to send that image to the next activity. How can I send tha

相关标签:
3条回答
  • 2020-12-18 16:42

    You can use like:

    I suppose that: send image to Activity B from A

    Actvity: A

      Intent i = new Intent(A.this,B.class);
    
      i.putExtra("image_send",bitmap)
      //with bitmap is image that you want to send.
      startActivity(i);
    

    Activity B:

      //receive image
      Bitmap b = (Bitmap) getIntent().ParcelableExtra("image_send")
    
    0 讨论(0)
  • 2020-12-18 16:43

    for this first u save that image in one file and in other activity take that image from that file

    0 讨论(0)
  • 2020-12-18 16:43

    To pass the data between two activities:

    bytes[] imgs = ... // your image
    Intent intent = new Intent(this, YourActivity.class);
    intent.putExtra("img", imgs);
    startActivity(intent);
    

    Then in YourActivity:

    bytes[] receiver = getIntent().getExtra("imgs");
    
    0 讨论(0)
提交回复
热议问题