How to capture more than one image in Android?

I want to re-render 4 images and save them in my custom folder and want to display them on screen in lower format.

_________________________________________
| Image1        |     Image2             | 
|               |                        |
|_______________|________________________|
| Image3        |    Image4              |
|               |                        |
|_______________|________________________|

MediaStore.ACTION_IMAGE_CAPTURE

      

Using this I can only get one image and return, and in order to accept it I have to open it again. I want to render 4 images in one event and display it on the screen.

btn_takeimg.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Intent camera = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
            File file = Environment.getExternalStorageDirectory();
            File imgFile = new File(file+File.separator+"Images"+File.separator+"images30.jpg");
            Uri uriSavedImage= FileProvider.getUriForFile(CameraApp.this,
                    BuildConfig.APPLICATION_ID + ".provider",imgFile);
            camera.putExtra(MediaStore.EXTRA_OUTPUT, uriSavedImage);
            startActivityForResult(camera, 1);
        }
    });

}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if(requestCode == 1 && resultCode == Activity.RESULT_OK){
        Toast.makeText(this, "Succesfully Captured", Toast.LENGTH_SHORT).show();
    }
    else {
        Toast.makeText(this, "Error While capturing image`", Toast.LENGTH_SHORT).show();
    }
}

      

or if it can be implemented in another way.

+3


source to share





All Articles