Home | History | Annotate | Download | only in base

Lines Matching defs:uri

11 import android.net.Uri;
25 * This class provides methods to access content URI schemes.
35 * Provides functionality to translate a file into a content URI for use
40 * Generate a content URI from the given file.
44 Uri getContentUriFromFile(Context context, File file);
56 public static Uri getContentUriFromFile(Context context, File file) {
66 * Opens the content URI for reading, and returns the file descriptor to
70 * @param uriString the content URI to open
83 * Check whether a content URI exists.
86 * @param uriString the content URI to query.
87 * @return true if the URI exists, or false otherwise.
109 * Retrieve the MIME type for the content URI.
112 * @param uriString the content URI to look up.
118 Uri uri = Uri.parse(uriString);
119 if (isVirtualDocument(uri, context)) {
120 String[] streamTypes = resolver.getStreamTypes(uri, "*/*");
123 return resolver.getType(uri);
127 * Helper method to open a content URI and returns the ParcelFileDescriptor.
130 * @param uriString the content URI to open.
131 * @return AssetFileDescriptor of the content URI, or NULL if the file does not exist.
135 Uri uri = Uri.parse(uriString);
138 if (isVirtualDocument(uri, context)) {
139 String[] streamTypes = resolver.getStreamTypes(uri, "*/*");
142 resolver.openTypedAssetFileDescriptor(uri, streamTypes[0], null);
156 ParcelFileDescriptor pfd = resolver.openFileDescriptor(uri, "r");
162 Log.w(TAG, "Cannot find content uri: " + uriString, e);
164 Log.w(TAG, "Cannot open content uri: " + uriString, e);
166 Log.w(TAG, "Unknown content uri: " + uriString, e);
168 Log.w(TAG, "Unknown content uri: " + uriString, e);
175 * Method to resolve the display name of a content URI.
177 * @param uri the content URI to be resolved.
180 * @return the display name of the @code uri if present in the database
183 public static String getDisplayName(Uri uri, Context context, String columnField) {
184 if (uri == null) return "";
188 cursor = contentResolver.query(uri, null, null, null, null);
200 String[] mimeTypes = contentResolver.getStreamTypes(uri, "*/*");
224 * Checks whether the passed Uri represents a virtual document.
226 * @param uri the content URI to be resolved.
230 private static boolean isVirtualDocument(Uri uri, Context context) {
232 if (uri == null) return false;
233 if (!DocumentsContract.isDocumentUri(context, uri)) return false;
237 cursor = contentResolver.query(uri, null, null, null, null);