MediaStore.CreateTrashRequest 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
建立 PendingIntent 一個會提示使用者丟棄所要求媒體項目的視窗。
[Android.Runtime.Register("createTrashRequest", "(Landroid/content/ContentResolver;Ljava/util/Collection;Z)Landroid/app/PendingIntent;", "", ApiSince=30)]
public static Android.App.PendingIntent CreateTrashRequest(Android.Content.ContentResolver resolver, System.Collections.Generic.ICollection<Android.Net.Uri> uris, bool value);
[<Android.Runtime.Register("createTrashRequest", "(Landroid/content/ContentResolver;Ljava/util/Collection;Z)Landroid/app/PendingIntent;", "", ApiSince=30)>]
static member CreateTrashRequest : Android.Content.ContentResolver * System.Collections.Generic.ICollection<Android.Net.Uri> * bool -> Android.App.PendingIntent
參數
- resolver
- ContentResolver
曾經與 MediaStore#AUTHORITY.
通常這個值為 Context#getContentResolver(),但如果你需要更明確的生命週期控制,你可以取得 並 ContentProviderClient 用 ContentResolver#wrap(ContentProviderClient)包裝。
- uris
- ICollection<Uri>
此請求中應包含的媒體項目。 每個項目必須由 主機,MediaStore#AUTHORITY且必須引用特定媒體項目。BaseColumns#_ID
- value
- Boolean
MediaColumns#IS_TRASHED應用價值。
傳回
- 屬性
備註
建立 PendingIntent 一個會提示使用者丟棄所要求媒體項目的視窗。 當使用者批准此請求時, MediaColumns#IS_TRASHED 會設定在這些項目上。
此呼叫僅產生提示請求;要顯示提示詞,請用 Activity#startIntentSenderForResultPendingIntent#getIntentSender()。 接著你可以透過測試 Activity#RESULT_OK 在 Activity#onActivityResult中 來判斷使用者是否批准了你的請求。 所請求的操作在該活動結果交付前已完全完成。
顯示的提示會反映你所請求的所有媒體項目,包括你已經擁有寫入權限的項目。 如果你想在請求存取前確定是否已經持有寫入權限,請使用 Context#checkUriPermission(Uri, int, int, int) 。Intent#FLAG_GRANT_WRITE_URI_PERMISSION
注意:如果你的應用程式目標達到 android.os.Build.VERSION_CODES#BAKLAVA 以上,每次請求最多只能寄送2000 尿路幣。 嘗試傳送超過 2000 個 URIS,將導致 java.lang.IllegalArgumentException。
此頁面的部分是根據 Android 開放原始碼專案所建立和共用的工作進行修改,並根據 Creative Commons 2.5 屬性授權中所述的詞彙使用。