android-10.0

Android Studio MediaStore, below SDK 29 save image in sd card fails

≯℡__Kan透↙ 提交于 2020-06-17 09:31:21
问题 I need to save image in sd_card's pictures directory below Android 10.I have implemented scoped storage & This code works in sdk 29 & above, because MediaStore.getExternalVolumeNames was added in sdk 29. Below sdk 29 how to get getContentUri of sd_card . val values = ContentValues().apply { put(MediaStore.Images.Media.DISPLAY_NAME, destinationFileName) put(MediaStore.Images.Media.MIME_TYPE, "image/jpeg") put(MediaStore.Images.Media.RELATIVE_PATH, Environment.DIRECTORY_PICTURES + File

Save .txt file on Android Q

我只是一个虾纸丫 提交于 2020-06-01 06:52:32
问题 I was trying to save text file using below code try { FileOutputStream fos = new FileOutputStream(TXT_FILE_NAME, true); FileWriter fWriter; try { fWriter = new FileWriter(fos.getFD()); fWriter.write(binding.tvExtractedResult.getText().toString()); fWriter.close(); } catch (Exception e) { e.printStackTrace(); } finally { fos.getFD().sync(); fos.close(); Toast.makeText(this, "File Saved Successfully", Toast.LENGTH_LONG).show(); } } catch (Exception e) { Toast.makeText(this, "Error while saving

Save .txt file on Android Q

牧云@^-^@ 提交于 2020-06-01 06:52:25
问题 I was trying to save text file using below code try { FileOutputStream fos = new FileOutputStream(TXT_FILE_NAME, true); FileWriter fWriter; try { fWriter = new FileWriter(fos.getFD()); fWriter.write(binding.tvExtractedResult.getText().toString()); fWriter.close(); } catch (Exception e) { e.printStackTrace(); } finally { fos.getFD().sync(); fos.close(); Toast.makeText(this, "File Saved Successfully", Toast.LENGTH_LONG).show(); } } catch (Exception e) { Toast.makeText(this, "Error while saving

java.io.IOException: No such file or directory (save image)

喜夏-厌秋 提交于 2020-05-31 06:09:52
问题 I upload the photos I selected from the device to ftp. But despite the photo I have chosen from the device, I get the "no such file directory" error. Although I give the application permissions, it does not save it to IMAGE_DIRECTORY that I have chosen in the application. So I get this error. What is the reason why it did not save the file, even though I gave the permissions? Error line: f.createNewFile(); error code: W/System.err: java.io.IOException: No such file or directory at java.io

java.io.IOException: No such file or directory (save image)

血红的双手。 提交于 2020-05-31 06:09:12
问题 I upload the photos I selected from the device to ftp. But despite the photo I have chosen from the device, I get the "no such file directory" error. Although I give the application permissions, it does not save it to IMAGE_DIRECTORY that I have chosen in the application. So I get this error. What is the reason why it did not save the file, even though I gave the permissions? Error line: f.createNewFile(); error code: W/System.err: java.io.IOException: No such file or directory at java.io

Android Q 10 Connect to network WifiNetworkSpecifier

拈花ヽ惹草 提交于 2020-05-25 02:34:48
问题 Since Android Q doesn't allow the WifiManager to add Networks, they gave the advise to use WifiNetworkSpecifier instead. With the WifiNetworkSuggestionBuilder I was already able to display the notification on the statusbar, that user can join the network. But this API doesn't fulfill my requirements since that I don't the user to have to use the suggestion from the statusbar. With WifiNetworkSpecifier I was also already able to display a popup about joining the network and the app also

How to update metadata of audio file in Android Q media store?

情到浓时终转凉″ 提交于 2020-05-21 21:38:13
问题 Updating metadata of audio file in media store is not working in Android Q OS, it works in all other OS. I am using content provider with uri specified as MediaStore.Audio.Media.EXTERNAL_CONTENT_URI. It is working fine in all below Android Q device. Below is the code that I am using to update track metadata. ContentValues cv = new ContentValues(); ContentResolver resolver = getContentResolver(); Uri uri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI; cv.put(MediaStore.Audio.Media.TITLE,

How to update metadata of audio file in Android Q media store?

白昼怎懂夜的黑 提交于 2020-05-21 21:35:28
问题 Updating metadata of audio file in media store is not working in Android Q OS, it works in all other OS. I am using content provider with uri specified as MediaStore.Audio.Media.EXTERNAL_CONTENT_URI. It is working fine in all below Android Q device. Below is the code that I am using to update track metadata. ContentValues cv = new ContentValues(); ContentResolver resolver = getContentResolver(); Uri uri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI; cv.put(MediaStore.Audio.Media.TITLE,

Replacement for “GROUP BY” in ContentResolver query in Android Q ( Android 10, API 29 changes)

 ̄綄美尐妖づ 提交于 2020-05-16 03:59:46
问题 I'm upgrading some legacy to target Android Q, and of course this code stop working: String[] PROJECTION_BUCKET = {MediaStore.Images.ImageColumns.BUCKET_ID, MediaStore.Images.ImageColumns.BUCKET_DISPLAY_NAME, MediaStore.Images.ImageColumns.DATE_TAKEN, MediaStore.Images.ImageColumns.DATA, "COUNT(" + MediaStore.Images.ImageColumns._ID + ") AS COUNT", MediaStore.Files.FileColumns.MEDIA_TYPE, MediaStore.MediaColumns._ID}; String BUCKET_GROUP_BY = " 1) and " + BUCKET_WHERE.toString() + " GROUP BY

Crash when using bundled ttf font on Android 10 / Android Q

半腔热情 提交于 2020-05-15 04:32:26
问题 After I updated the target level for my Android app from 28 to 29 (Android 10) the app crashes on a Pixel 3 (with Android 10). Versions used Android Gradle Plugin 3.5.0 Gradle 5.5.1 Question: Is this a known issue? Details The crash happens on various layouts using different tags (TextView, androidx.appcompat.widget.AppCompatTextView, etc) I use the attribute "android:fontFamily" and reference a font bundled in one of my external libraries. The font file, opensans_regular.ttf , is placed in