Split method not working with "." in android and java .
String[] extension = selectedItem.getmName().split(".");
Split method not working with "." in android and java .
String[] extension = selectedItem.getmName().split(".");
Try :
String[] extension = FilenameUtils.getExtension(selectedItem.getName())
Reference : How do I get the file extension of a file in Java?
Simply escape the ".":
String[] sentences = selectedItem.getmName().split("\\.");
Since "." is regex for any character the result would always be an array of 0 length since every character is a delimeter and split
only returns what is not a delimeter - which would be nothing.
String[] sentences = selectedItem.getmName().split("\\.");
This must works. This is a special situation for dot.