如何获取图像视图内图像的图像路径?

问题描述:

我已经在图像视图中设置了缩放图像。现在我想要获得缩放图像的路径。那可能吗?我听说它存储在内部存储器的某个地方。如何获取图像视图内图像的图像路径?

UPDATE:

我有这样的问题:我已经设置了一套图像从一个imagview画廊。我现在想要的是保存这个状态(这意味着图像视图中的图像)。我怎样才能做到这一点?

我想过用blob将整个图像保存到我的SQL数据库。但后来我听说应该采取形象的道路。

谁能告诉我怎么做到这一点?

这是我从图库中获取图像的方式,以及如何将其设置在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); 
     } 
    } 
} 

试试这个

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

有一个关于如何保存位图对象here更多的例子。

我可能是错在这里,但我不认为缩放后的图像保存..我想将图像从原始源暂时缩放。

你需要什么路径?如果我们知道路径是什么,我们可能会更有效地帮助。

+0

查看更新! – user1420042