本文整理汇总了Java中android.content.ContentProviderClient.call方法的典型用法代码示例。如果您正苦于以下问题:Java ContentProviderClient.call方法的具体用法?Java ContentProviderClient.call怎么用?Java ContentProviderClient.call使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.content.ContentProviderClient
的用法示例。
在下文中一共展示了ContentProviderClient.call方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isChildDocument
import android.content.ContentProviderClient; //导入方法依赖的package包/类
public static boolean isChildDocument(ContentProviderClient client, Uri parentDocumentUri,
Uri childDocumentUri) throws RemoteException {
final Bundle in = new Bundle();
in.putParcelable(DocumentsContract.EXTRA_URI, parentDocumentUri);
in.putParcelable(DocumentsContract.EXTRA_TARGET_URI, childDocumentUri);
final Bundle out = client.call(METHOD_IS_CHILD_DOCUMENT, null, in);
if (out == null) {
throw new RemoteException("Failed to get a reponse from isChildDocument query.");
}
if (!out.containsKey(DocumentsContract.EXTRA_RESULT)) {
throw new RemoteException("Response did not include result field..");
}
return out.getBoolean(DocumentsContract.EXTRA_RESULT);
}
示例2: createDocument
import android.content.ContentProviderClient; //导入方法依赖的package包/类
public static Uri createDocument(ContentProviderClient client, Uri parentDocumentUri,
String mimeType, String displayName) throws Exception {
final Bundle in = new Bundle();
in.putParcelable(DocumentsContract.EXTRA_URI, parentDocumentUri);
in.putString(DocumentsContract.Document.COLUMN_MIME_TYPE, mimeType);
in.putString(DocumentsContract.Document.COLUMN_DISPLAY_NAME, displayName);
final Bundle out = client.call(METHOD_CREATE_DOCUMENT, null, in);
return out.getParcelable(DocumentsContract.EXTRA_URI);
}
示例3: renameDocument
import android.content.ContentProviderClient; //导入方法依赖的package包/类
public static Uri renameDocument(ContentProviderClient client, Uri documentUri,
String displayName) throws RemoteException {
final Bundle in = new Bundle();
in.putParcelable(DocumentsContract.EXTRA_URI, documentUri);
in.putString(DocumentsContract.Document.COLUMN_DISPLAY_NAME, displayName);
final Bundle out = client.call(METHOD_RENAME_DOCUMENT, null, in);
final Uri outUri = out.getParcelable(DocumentsContract.EXTRA_URI);
return (outUri != null) ? outUri : documentUri;
}
示例4: copyDocument
import android.content.ContentProviderClient; //导入方法依赖的package包/类
public static Uri copyDocument(ContentProviderClient client, Uri sourceDocumentUri,
Uri targetParentDocumentUri) throws RemoteException {
final Bundle in = new Bundle();
in.putParcelable(DocumentsContract.EXTRA_URI, sourceDocumentUri);
in.putParcelable(DocumentsContract.EXTRA_TARGET_URI, targetParentDocumentUri);
final Bundle out = client.call(METHOD_COPY_DOCUMENT, null, in);
return out.getParcelable(DocumentsContract.EXTRA_URI);
}
示例5: moveDocument
import android.content.ContentProviderClient; //导入方法依赖的package包/类
public static Uri moveDocument(ContentProviderClient client, Uri sourceDocumentUri,
Uri sourceParentDocumentUri, Uri targetParentDocumentUri) throws RemoteException {
final Bundle in = new Bundle();
in.putParcelable(DocumentsContract.EXTRA_URI, sourceDocumentUri);
in.putParcelable(DocumentsContract.EXTRA_PARENT_URI, sourceParentDocumentUri);
in.putParcelable(DocumentsContract.EXTRA_TARGET_URI, targetParentDocumentUri);
final Bundle out = client.call(METHOD_MOVE_DOCUMENT, null, in);
return out.getParcelable(DocumentsContract.EXTRA_URI);
}
示例6: removeDocument
import android.content.ContentProviderClient; //导入方法依赖的package包/类
public static void removeDocument(ContentProviderClient client, Uri documentUri,
Uri parentDocumentUri) throws RemoteException {
final Bundle in = new Bundle();
in.putParcelable(DocumentsContract.EXTRA_URI, documentUri);
in.putParcelable(DocumentsContract.EXTRA_PARENT_URI, parentDocumentUri);
client.call(METHOD_REMOVE_DOCUMENT, null, in);
}
示例7: call
import android.content.ContentProviderClient; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
public static Bundle call(ContentResolver resolver, ContentProviderClient client, Uri uri, String method, String arg, Bundle extras) throws Exception{
if(Utils.hasJellyBeanMR1()){
return client.call(method, arg, extras);
}
else{
return resolver.call(uri, method, arg, extras);
}
}
示例8: call
import android.content.ContentProviderClient; //导入方法依赖的package包/类
public static Bundle call(Context context, Uri uri, String method, String arg, Bundle extras) {
if (VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) {
return context.getContentResolver().call(uri, method, arg, extras);
}
ContentProviderClient client = crazyAcquireContentProvider(context, uri);
Bundle res = null;
try {
res = client.call(method, arg, extras);
} catch (RemoteException e) {
e.printStackTrace();
} finally {
releaseQuietly(client);
}
return res;
}
示例9: deleteDocument
import android.content.ContentProviderClient; //导入方法依赖的package包/类
public static void deleteDocument(ContentProviderClient client, Uri documentUri)
throws RemoteException {
final Bundle in = new Bundle();
in.putParcelable(DocumentsContract.EXTRA_URI, documentUri);
client.call(METHOD_DELETE_DOCUMENT, null, in);
}
示例10: call
import android.content.ContentProviderClient; //导入方法依赖的package包/类
@TargetApi(VERSION_CODES.JELLY_BEAN_MR1)
@Override
public Bundle call(String method, String arg, Bundle extras) {
String targetAuthority = extras != null ? extras.getString(Env.EXTRA_TARGET_AUTHORITY) : null;
String targetMethod = extras != null ? extras.getString(Env.EXTRA_TARGET_AUTHORITY) : null;
if (!TextUtils.isEmpty(targetMethod) && !TextUtils.equals(targetMethod, method)) {
ContentProviderClient client = getContentProviderClient(targetAuthority);
try {
return client.call(targetMethod, arg, extras);
} catch (RemoteException e) {
handleExpcetion(e);
}
}
return super.call(method, arg, extras);
}