Java tutorial
//package com.java2s; //License from project: Open Source License import android.provider.MediaStore.Audio; import android.provider.MediaStore.Video; public class Main { /** * Returns true if uri is a media uri. * * @param uri * @return */ public static boolean isMediaUri(String uri) { if (uri.startsWith(Audio.Media.INTERNAL_CONTENT_URI.toString()) || uri.startsWith(Audio.Media.EXTERNAL_CONTENT_URI.toString()) || uri.startsWith(Video.Media.INTERNAL_CONTENT_URI.toString()) || uri.startsWith(Video.Media.EXTERNAL_CONTENT_URI.toString())) { return true; } else { return false; } } }