Android Is it better to store it or use it in temporary memory during image processing?

I am trying to create an application that takes an image from a camera and sends it back to the main action in order to display it in ImageVew. I saw a tutorial that saves an image on an SD card when shooting. I can save the file, but it's hard for me to get the location of the saved image.

I think that saving the image on the SD card is too much, since this image is not so important.

Is there a way to “save” the image that I just took with the camera in the BitMap element? if it is more efficient than storing it on an SD card?


Here is my MainActivity.java:

public class MainActivity extends AppCompatActivity {
private Uri imgLocation;
ImageView mImageView;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    Button capture = (Button) findViewById(R.id.am_btn_camera);
    capture.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

            imgLocation = Uri.fromFile(new File(Environment.getExternalStorageDirectory(), "fname_" +
                    String.valueOf(System.currentTimeMillis()) + ".jpg"));

            intent.putExtra(MediaStore.EXTRA_OUTPUT, imgLocation);
            startActivityForResult(intent, 1);
        }
    });
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (requestCode == 1 && resultCode == RESULT_OK) {

        Log.e("URI",imgLocation.toString());
        mImageView.setImageBitmap(BitmapFactory.decodeFile(imgLocation.toString()));
    }
}}
+4
3

/ , . , :

URL- HTTP, .

OutOfMemoryError , . , , 1 Bitmap, .

+3

filepath activities.

Android Bitmaps , , .

, , , outOfMemory .

+1

Picasso. .

, .

0

All Articles