如何获取存储在内部存储中的图像路径?

时间:2015-04-26 09:28:23

标签: android image

我想从内部存储中获取图像的路径。

if (requestCode == TAKE_PHOTO_CODE && resultCode == RESULT_OK) {
    Log.d("CameraDemo", "Pic saved");
    String whatsAppMessage = "This is the number plate of vehicle in which I am going to travel ";

    //You can read the image from external drove too
    Uri uri = Uri.parse("here I want the path of the image stored in internal storage");
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_SEND);
    intent.putExtra(Intent.EXTRA_TEXT, whatsAppMessage);
    intent.setType("text/plain");
    intent.putExtra(Intent.EXTRA_STREAM,uri);
    intent.setType("image/jpg");
    intent.setPackage("com.whatsapp");

    startActivity(intent);
}

怎么做?

1 个答案:

答案 0 :(得分:1)

  

对于内部Environment.getDataDirectory()

     

对于外部Environment.getExternalStorageDirectory()