![](/img/trans.png)
[英]How to write a JSON file to a specific location using the Media Store API in Android
在 Android 上調用了一個目錄選擇器:val intent = Intent(Intent.ACTION_OPEN_DOCUMENT_TREE) intent.addFlags( Intent.FLAG_GRANT_READ_URI_PERMISSION o ...
[英]How to write a JSON file to a specific location using the Media Store API in Android
在 Android 上調用了一個目錄選擇器:val intent = Intent(Intent.ACTION_OPEN_DOCUMENT_TREE) intent.addFlags( Intent.FLAG_GRANT_READ_URI_PERMISSION o ...
[英]How to get Folder size and number of Files avaliable from Folder path in Kotlin
我正在嘗試使用 kotlin 創建一個視頻播放器應用程序,首先我通過使用 MediaStore 獲取了視頻文件,然后將其存儲在 ArrayList 中,到目前為止它是完美的但是當我制作視頻文件夾列表時,我試圖找出這些文件夾的大小以及這些文件夾中有多少視頻文件,但我失敗了。 像這樣(圖片)查看此圖片以 ...
[英]Reading files from specific folder and show them in recyclerview android
我已經從外部存儲中獲取了我所有的 PDF 文件,並在我的應用程序回收器視圖中顯示了它們,但現在我遇到了問題。 我想從某個特定文件夾中獲取所有 pdf 文件,並將它們顯示在我的應用程序的回收站視圖中。 有沒有可能從特定目錄中獲取的方法? 這個函數完全沒問題,可以從存儲中獲取所有文件,但我不想從外部存儲 ...
[英]How to copy internal directory audio files to external directory in Android 11
我有一個音樂應用程序,可讓用戶購買音樂,並用於將其存儲在外部存儲的自己的文件夾中(在 android 10 之前完美運行)。 從 android 11 開始,最初我使用 getFilesDir(internal storage) 並且該版本已在 play store 上運行,現在用戶無法在文件管理器 ...
[英]How do you get access to a testing device's files when running instrumentation tests for Android
我已經設置了一個物理設備,其中包含可以通過 MediaStore 檢索的文件。 我的目標是在儀器測試中通過 MediaStore 檢索這些文件。 目前,當我將調試應用程序推送到設備並手動測試時,會找到設備文件。 問題是當我運行儀器測試時,我從 MediaStore 中一無所獲。 有沒有辦法在儀器測試 ...
[英]How do you use a Uri opened with ActivityResultContracts.OpenDocumentTree() and query the MediaStore for all audio in that folder?
我正在嘗試獲取用戶選擇的文件夾中包含的所有音頻。 要求用戶選擇這樣的文件夾 我正在嘗試像這樣查詢文件夾 我已經嘗試了以下數據 這些都不起作用。 當應該有三個文件時,查詢為空。 這些文件在 MediaStore 中,因為 MediaStore 中所有音頻文件的查詢都包含它們。 文檔不是很有幫助(像往 ...
[英]Querying for all files above a certain size with mediastore
我正在嘗試使用媒體存儲 API 查詢 android 設備中的每個文件。 是否有更短的方法來編寫selection字符串以包含設備中的所有文件,而不必為音頻、視頻、圖像和 NON_MEDIA 分別編寫? 另外,我如何進行查詢,此外,僅獲取特定文件大小以上的文件。 ...
[英]Getting files of a particular file type with android Mediastore.File
如何使用Mediastore.Files獲取外部和 SD 卡存儲中存在的特定文件類型的所有文件,例如 pdf 文件。 我剛剛嘗試使用 java File API 但這需要很長時間才能列出它們。 ...
[英]MediaStore creates a new file with instead of overwriting the existing one
我想定期寫入文件,如果已經存在,總是替換它。 問題是,使用MediaStore ,而不是覆蓋文件,它會創建一個具有相同名稱的新文件並在其上附加一個數字 如果我調用exportToFile("test.txt", "Hello world") ,它會寫入一個文件test.txt 。 如果我再次調用相同 ...
[英]Accessing recent images in a folder using MediaStore
我目前正在使用此代碼從/DCIM/文件夾訪問最近的圖像 -final Cursor cursor = chatActivity.this.getContentResolver() .query(MediaStore.Images.Media.EXTERNAL_CONT ...
[英]How to list out only either static or animated images in Android?
我想檢測並顯示最新的圖像,它應該是用戶選擇的動畫或靜態圖像。 也不能依賴擴展。因為 將沒有擴展 webp 圖像可以是具有相同擴展名的動畫或靜態 (.webp) 可能是錯誤的擴展 有沒有辦法識別圖像是動畫(webp、gif、apng)還是靜態(jpg、png、webp 等)? 我還想 ...
[英]Getting real path from MediaStore API
我正在為我的應用程序構建一個內置文件管理器,並且我正在使用 MediaStore 來查詢文件。 我讓一切正常,除了我返回的 URI 不符合 Glide 的喜好。 類 java.io.FileNotFoundException:/external/images/media/37:打開失敗:EN ...
[英]Can't get audio files from external storage - Android Studio
我正在按照本指南創建音頻播放器: https ://www.sitepoint.com/a-step-by-step-guide-to-building-an-android-audio-player-app/。 當我嘗試查找音頻文件時出現問題。 創建游標后,它不為空,但使用 cursor.getC ...
[英]How to find and retrieve live photos from external or media storage in android?
我想從 android 設備中檢索所有實時照片,有什么建議嗎? ...
[英]Storage location of Bitmap image when it is downloaded by Asynctask
我正在使用 AsyncTask 下載圖像文件以保存在應用程序內部存儲中,但我無法在我的模擬器設備管理器中找到該文件。 這是代碼,你能告訴我它保存圖像的確切位置嗎 ...
[英]How to save a bitmap on storage in Android Q and later?
在我的應用程序中,我必須將 bitmap 作為 PNG 文件存儲在共享的 memory 中,以使其對圖庫應用程序可見。 首先,我嘗試將圖像存儲在/Android/data/package.name/files/Pictures中。 我從context.getExternalFilesDir(Env ...
[英]MediaStore Uri for External?
作為 MediaStore 的新手,我不知道這個 uri 有什么問題: 那些 uri 的回報為零。 我的示例代碼: 嘗試使用Uri.parse解決但沒有應用排序過濾器。 回到MediaStore.Files.getContentUri("external") ,它通過 Android 8.1 設備 ...
[英]How to copy Images/Videos from DocumentFile Object to Gallery Folder using MediaStore Api
我使用 Document Tree Intent 獲得了對該文件夾的訪問權限:-content://com.android.externalstorage.documents/tree/primary%3AExampleApp%2FMedia%2F.hiddenMedia 上述文件夾中圖像的 UR ...
[英]Access files that were created by my application
我正在使用MediaStore在 Android 上創建文件,然后我需要訪問它們進行閱讀。 我怎樣才能做到這一點? 有沒有辦法查詢我的所有文件,或者以某種方式通過應用程序所有者通過ContentResolver過濾它們,或者我可以在創建時標記我的文件以便稍后通過此標記過濾它們? 我的代碼:val r ...
[英]Displaying an image from internal storage from android phone with Kotlin
我制作了一個非常簡單的應用程序,可以使用帶取景器的相機 x 拍照,它會顯示在同一活動中拍攝的圖像我正在嘗試獲取從內部存儲中拍攝的所有圖像,並將它們顯示在應用程序的另一個活動中使用回收器視圖 我對回收器視圖很好,我可以使用帶有外部 Api 的視圖來顯示圖像和數據,但我只是不知道如何從內部存儲中獲取圖像 ...