How to extract filename from Uri?

Now, we can extract filename with and without extension :)
You will convert your bitmap to uri and get the real path of your file. Now we have a path.
Here is how to extract filename :
Markdown:
Uri uri = getImageUri(bitmap);
String path = getRealPathFromURI(uri);
String filename = path.substring(path.lastIndexOf("/")+1);
String file;
if (filename.indexOf(".") > 0) {
    file = filename.substring(0, filename.lastIndexOf("."));
} else {
    file =  filename;
}
Log.d(TAG, "Real Path: " + path);
Log.d(TAG, "Filename With Extension: " + filename);
Log.d(TAG, "File Without Extension: " + file);
Gist:
Uri uri = getImageUri(bitmap);
String path = getRealPathFromURI(uri);
String filename = path.substring(path.lastIndexOf("/")+1);
String fileWOExtension;
if (filename.indexOf(".") > 0) {
    fileWOExtension = filename.substring(0, filename.lastIndexOf("."));
} else {
    fileWOExtension =  filename;
}
Log.d(TAG, "Real Path: " + path);
Log.d(TAG, "Filename With Extension: " + filename);
Log.d(TAG, "File Without Extension: " + fileWOExtension);

How to extract filename from Uri?

Now, we can extract filename with and without extension :) You will convert your bitmap to uri and get the real path of your file. Now w...