Android examples for android.net:Uri
get Uri File Extension
public class Main { static String getExtension(String mediaUri) { if (mediaUri == null || mediaUri.trim().isEmpty()) { return null; }/* w ww .j a va 2 s . co m*/ int periodIndex = mediaUri.lastIndexOf('.'); if (periodIndex == -1 || periodIndex >= mediaUri.length()) { return null; } String rawExtension = mediaUri.substring(periodIndex); return rawExtension.toLowerCase(); } }