Assuming I am given a URI, and I want to find the file extension of the file that is returned, what do I have to do in Java.
For example the file at http://www.daml.
I am doing it in this way.
You can check any file extension with more validation:
String stringUri = uri.toString();
String fileFormat = "png";
if (stringUri.contains(".") && fileFormat.equalsIgnoreCase(stringUri.substring(stringUri.lastIndexOf(".") + 1))) {
// do anything
} else {
// invalid file
}