Example usage for android.net Uri toString

List of usage examples for android.net Uri toString

Introduction

In this page you can find the example usage for android.net Uri toString.

Prototype

public abstract String toString();

Source Link

Document

Returns the encoded string representation of this URI.

Usage

From source file:Main.java

public static String uri2String(Uri uri) {
    return uri.toString();
}

From source file:Main.java

public static int checkSource(Uri targetUri) {
    if (targetUri.toString().length() > 0) {
        return 1;
    } else {//from w w w. ja  v a 2 s  .c  o  m
        return 0;
    }
}

From source file:Main.java

/**
 * Convert an Android Uri to a String//from  w w  w  . j a  v  a2s .c o m
 * @param uri android.net.Uri to convert
 * @return String
 */
public static String convertAndroidUriToString(android.net.Uri uri) {
    return uri.toString();
}

From source file:Main.java

private static boolean isFile(Uri uri) {
    if (uri != null && uri.toString().startsWith("file://")) {
        return true;
    }//from w w  w . ja v a2  s . c  o m
    return false;
}

From source file:Main.java

/**
 * Generates a cache key out of the given {@link Uri}.
 *
 * @param uri Uri of a content which the requested key is for.
 *///www.ja  v  a2s.  com
public static String generateKey(Uri uri) {
    return uri.toString();
}

From source file:Main.java

/**
 * /*  w  w w. j  ava2s.co  m*/
 * @param uri The Uri to check.
 * @return Whether the Uri is from a content provider as kind "content://..."
 */
public static boolean isContentDocument(Uri uri) {
    return uri.toString().startsWith(URI_CONTENT_SCHEME);
}

From source file:Main.java

public static String returnCamera(File photo) {
    if (photo == null)
        return null;
    Uri originalUri = Uri.fromFile(photo);
    return originalUri.toString().replace("file://", "");
}

From source file:Main.java

public static boolean validateSourceUri(Uri uri) {
    return uri != null && !TextUtils.isEmpty(uri.toString());
}

From source file:Main.java

/** Converts a URI into a string, returns null if the given URI is null. */
public static String uriToString(Uri uri) {
    return uri == null ? null : uri.toString();
}

From source file:Main.java

/**
 * Returns true if uri is a media uri./*from  w w  w  .  j  a v a 2 s . c o m*/
 * 
 * @param uri
 * @return
 */
public static boolean isMediaUri(Uri uri) {
    String uriString = uri.toString();
    if (uriString.startsWith(Audio.Media.INTERNAL_CONTENT_URI.toString())
            || uriString.startsWith(Audio.Media.EXTERNAL_CONTENT_URI.toString())
            || uriString.startsWith(Video.Media.INTERNAL_CONTENT_URI.toString())
            || uriString.startsWith(Video.Media.EXTERNAL_CONTENT_URI.toString())) {
        return true;
    } else {
        return false;
    }
}