pass a bitmap image from one activity to another

后端 未结 8 1612
清酒与你
清酒与你 2020-12-05 21:57

In my app i am displaying no.of images from gallery from where as soon as I select one image , the image should be sent to the new activity where the selected image will be

8条回答
  •  时光说笑
    2020-12-05 22:11

    I've found the easiest (but definitely not the most elegant) way is to use a static class member. eg:

    class PassedData
    {
        public Bitmap bm1, bm2, etc;
    
        private PassedData current;
    
        public static PassedData getCurrent() {return current;}
    
        public PassedData()
        {
            current = this;
        }
    }
    

    Then each activity can reference PassedData.getCurrent().

提交回复
热议问题