android-file

Why would an Android Open File intent hang while opening an image?

与世无争的帅哥 提交于 2021-02-11 17:45:21
问题 My Problem: When openFile() intent attempts StartActivityForResult , the application hangs with a blank screen and circular cursor. The file(s) are stored to app. What I have done: Before and after this issue I researched how to open files by use of Intents. I found a number of similar but different approaches and either used the literal example or a combination of various examples to see if I could find and resolve the issue (see some below). I'm not receiving any type of error message that

Why would an Android Open File intent hang while opening an image?

情到浓时终转凉″ 提交于 2021-02-11 17:45:01
问题 My Problem: When openFile() intent attempts StartActivityForResult , the application hangs with a blank screen and circular cursor. The file(s) are stored to app. What I have done: Before and after this issue I researched how to open files by use of Intents. I found a number of similar but different approaches and either used the literal example or a combination of various examples to see if I could find and resolve the issue (see some below). I'm not receiving any type of error message that

How to create Image File inside Internal Cache Directory in Android

陌路散爱 提交于 2021-02-11 09:51:32
问题 I want to have image.png inside cache/images/ in Internal Storage of Android. I am not able to have it with following code: File directory = new File(getContext().getCacheDir(), "images"); directory.mkdirs(); File mypath=new File(directory,"image.png"); FileOutputStream fos = null; try { fos = new FileOutputStream(mypath); bmap.compress(Bitmap.CompressFormat.PNG, 100, fos); } catch (Exception e) { e.printStackTrace(); } finally { try { fos.close(); } catch (IOException e) { e.printStackTrace(

What is com.android.externalstorage?

戏子无情 提交于 2021-02-08 08:06:39
问题 Despite this being a simple question I cannot find the answer on google or stackoverflow. When I use the following code I get this result //com.android.externalstorage.documents/tree/primary:Podcasts var intent = new Intent(Intent.ActionOpenDocumentTree); intent.PutExtra("android.content.extra.SHOW_ADVANCED", true); intent.PutExtra("android.content.extra.FANCY", true); intent.PutExtra("android.content.extra.SHOW_FILESIZE", true); Can you help me understand the parts of my result? 回答1: How

What is com.android.externalstorage?

寵の児 提交于 2021-02-08 08:05:28
问题 Despite this being a simple question I cannot find the answer on google or stackoverflow. When I use the following code I get this result //com.android.externalstorage.documents/tree/primary:Podcasts var intent = new Intent(Intent.ActionOpenDocumentTree); intent.PutExtra("android.content.extra.SHOW_ADVANCED", true); intent.PutExtra("android.content.extra.FANCY", true); intent.PutExtra("android.content.extra.SHOW_FILESIZE", true); Can you help me understand the parts of my result? 回答1: How

How to create folder (Android R - Api 30)?

故事扮演 提交于 2021-01-01 10:23:12
问题 Read that Android 11 has scoped storage, but I can't find any information, how can I create and use folder in /storage/emulated/0/ ? Old methods works only on api 29 and below :( 回答1: On Android 11 the restrictions in Android 10 concerning access to external storage are much less. Environment.getExternalStorageDirectory() is readable again and Environment.getExternalStoragePublicDirectory(...) is writable for folders like Environment.DIRECTORY_DOCUMENTS and so on. The Android OS is very picky

How to create folder (Android R - Api 30)?

限于喜欢 提交于 2021-01-01 10:23:06
问题 Read that Android 11 has scoped storage, but I can't find any information, how can I create and use folder in /storage/emulated/0/ ? Old methods works only on api 29 and below :( 回答1: On Android 11 the restrictions in Android 10 concerning access to external storage are much less. Environment.getExternalStorageDirectory() is readable again and Environment.getExternalStoragePublicDirectory(...) is writable for folders like Environment.DIRECTORY_DOCUMENTS and so on. The Android OS is very picky