我想从内部存储中获取图像的路径。
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);
}
怎么做?
答案 0 :(得分:1)
对于内部
Environment.getDataDirectory()
对于外部
Environment.getExternalStorageDirectory()