Java tutorial
//package com.java2s; //License from project: Apache License import android.net.Uri; public class Main { /** * @param uri uri to extract scheme from, possibly null * @return null if uri is null, result of uri.getScheme() otherwise */ public static String getSchemeOrNull(Uri uri) { return uri == null ? null : uri.getScheme(); } }