Reputation: 32853
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.
Upvotes: 2
Views: 813
Reputation: 2624
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.
Upvotes: 1