user2532233 user2532233 - 8 months ago 41
Android Question

Check if a file is an image or a video

Is there a way to check if the file I'm loading as a URI is a image or a video in android? I'm trying to dynamically loaded both images and videos into fragments for a list/detail view and need to tell them apart.


Easiest way is to check extensions I guess

if ( file.toString().endsWith(".jpg") {
} else if (file.toString().endsWith(".3gp")) {