As the title says, I want to get the name of the file which is just taken from camera. I have a full path of the image such as like this sdcard\\image.jpg
. So how can I get image.jpg name in android? Any sample code would be helpful.
Update
OR How can I simply get the name of the photo which is just taken from the camera? It doesnt matter if I know the path of the image.
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(cameraIntent, CAMERA_PIC_REQUEST);
In onActivityResult() method:
Bitmap thumbnail = (Bitmap) data.getExtras().get("data");
path=getLastImagePath();
int dotposition= path.lastIndexOf("/");
imageName = path.substring(dotposition + 1, path.length());
This will give you the path of the last image in "path" variable and image name in "imageName" variable.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.