Java tutorial
//package com.java2s; /* * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ import javax.annotation.Nullable; import android.net.Uri; public class Main { /** * Asset scheme for URIs */ public static final String LOCAL_ASSET_SCHEME = "asset"; /** * Check if uri represents local asset * * @param uri uri to check * @return true if uri's scheme is equal to "asset" */ public static boolean isLocalAssetUri(@Nullable Uri uri) { final String scheme = getSchemeOrNull(uri); return LOCAL_ASSET_SCHEME.equals(scheme); } /** * @param uri uri to extract scheme from, possibly null * @return null if uri is null, result of uri.getScheme() otherwise */ @Nullable public static String getSchemeOrNull(@Nullable Uri uri) { return uri == null ? null : uri.getScheme(); } }