1

I have set a scaled image in an image view. Now I want to get the path of THAT scaled image. Is that possible? I heard that it is stored somewhere in the internal memory.

UPDATE:

I have this problem: I have set an set an image from the gallery in an imagview. What I want now is to save this state (that means the image in the image view). How can I do that?

I thought about saving the entire image with a blob to my SQL database. But then I heard that should rather take the image path.

Can anyone tell me how I can do this?

This is how I get the image from the gallery and how I set it in my ImageView.

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode == RESULT_OK) {
        if (requestCode == PICK_FROM_FILE) {
            Uri selectedImageUri = data.getData();
            selectedImagePath = getPath(selectedImageUri);

            Log.v("IMAGE PATH====>>>> ",selectedImagePath);

            // Decode, scale and set the image.
            Bitmap myBitmap = BitmapFactory.decodeFile(selectedImagePath);
            Bitmap scaledBitmap = Bitmap.createScaledBitmap(myBitmap, NEW_WIDTH, NEW_HEIGHT, true);
            myBitmap.recycle();
            myBitmap = null;

            mImageView.setImageBitmap(scaledBitmap);
        }
    }
}
user1420042
  • 1,689
  • 9
  • 35
  • 53

1 Answers1

0

Try this

String filename = "myfilename"
FileOutputStream out = new FileOutputStream(filename)
scaledBitmap.compress(Bitmap.CompressFormat.PNG, 90, out);

There's more examples on how to save BitMap objects here.

Community
  • 1
  • 1
dotty
  • 40,405
  • 66
  • 150
  • 195