Code example for Intent

Methods: setDataAndTyperesolveActivity

    // @return a ResolveInfo instance for the mime type or null if the type is 
    // not handled by any activity. 
    private ResolveInfo resolveMime(String mime) {
        Intent viewIntent = new Intent(Intent.ACTION_VIEW);
        Uri uri = Uri.fromParts("file", MP3_FILE, null);
        viewIntent.setDataAndType(uri, mime);
        return mContext.getPackageManager().resolveActivity(
                viewIntent, PackageManager.MATCH_DEFAULT_ONLY);
    // Helper method to check the media playback activity handles the given mime type. 
    // @param mime type to test for 
    private void assertMediaPlaybackActivityHandles(String mime) throws Exception {
        ResolveInfo ri = resolveMime(mime);
Contextual code suggestions in your IDE  Get Codota for Java