Android examples for android.provider:MediaStore
Returns true if uri is a media uri.
//package com.java2s; import android.provider.MediaStore.Audio; import android.provider.MediaStore.Video; public class Main { /**/* ww w .j a v a2 s . c o m*/ * 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; } } }