rahul tandon
rahul tandon

Reputation: 1

How to get the path of an image stored in internal storage?

I want to get the path of the image from internal storage.

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);
}

How to do it?

Upvotes: 0

Views: 478

Answers (1)

Nb12se
Nb12se

Reputation: 513

For internal Environment.getDataDirectory()

For external Environment.getExternalStorageDirectory()

Upvotes: 1

Related Questions