android-internal-storage

Android Adoptable Storage - get free Space

情到浓时终转凉″ 提交于 2019-12-10 09:31:44
问题 I have a App that uses 3 kinds of storage: The internal storage, a external SD and if Version >= 6.0 a SD which is formatted as internal. I get the external SD path by using getExternalFilesDirs() , the internal Storage by getFilesDir() and the adopted (=internal) SD path by Environment.getExternalStorageDirectory() . Now, if I want to get the free Space, something like this: StatFs statFs = new StatFs(storageDir); long blocks = statFs.getAvailableBlocks(); return Formatter.formatFileSize

write a file to a folder in the android device internal storage

蹲街弑〆低调 提交于 2019-12-08 13:44:46
问题 I have a folder, called MyFolder, in the android device internal storage root directory. There is no external sd card mounted. The folder can be checked using says, ES file manager I want to write a file to that directory. I try the followings but seem all are not what I want. So how should sd be? Please help. File sd = Environment.getExternalStorageDirectory(); // File sd = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) ; // File sd = new File( Environment

How to get exact capacity from storage

醉酒当歌 提交于 2019-12-08 06:19:36
问题 I want to read the exact capacity from the intern storage programmatically. I's a Samsung Galaxy S7 Edge 32GB device what I am using. In the preinstalled Samsung FileManager (In German: Eigene Dateien) it shows me the total capacity of 32GB. Even in the menu => settings => Storage it shows me 32GB. (Showed in screenshots) When I use my code below it shows me a total capacity of 24,4GB. (Showed in Log at the end of the post) Question: How to get the exact 32GB total capacity of my device?

How to get exact capacity from storage

☆樱花仙子☆ 提交于 2019-12-07 04:54:36
I want to read the exact capacity from the intern storage programmatically. I's a Samsung Galaxy S7 Edge 32GB device what I am using. In the preinstalled Samsung FileManager (In German: Eigene Dateien) it shows me the total capacity of 32GB. Even in the menu => settings => Storage it shows me 32GB. (Showed in screenshots) When I use my code below it shows me a total capacity of 24,4GB. (Showed in Log at the end of the post) Question: How to get the exact 32GB total capacity of my device? Screenshots Full Code: package spicysoftware.com.space; import android.os.Environment; import android.os

Android Adoptable Storage - get free Space

不打扰是莪最后的温柔 提交于 2019-12-05 16:46:15
I have a App that uses 3 kinds of storage: The internal storage, a external SD and if Version >= 6.0 a SD which is formatted as internal . I get the external SD path by using getExternalFilesDirs() , the internal Storage by getFilesDir() and the adopted (=internal) SD path by Environment.getExternalStorageDirectory() . Now, if I want to get the free Space, something like this: StatFs statFs = new StatFs(storageDir); long blocks = statFs.getAvailableBlocks(); return Formatter.formatFileSize(this, blocks * statFs.getBlockSize()); works for internal storage and external SD, but for adopted SD it

get name and full path of a file

南楼画角 提交于 2019-12-02 10:20:58
问题 I used Intent ACTION_GET_CONTENT to show recent files from phone memory. That includes images, pdf, google drive documents(pdf, xlsx) as shown in screenshot below. I want to get the name and full path so that I can upload the file to server. I/m getting the mime type correctly as of now. public class MainActivity extends AppCompatActivity { Button btn; TextView txt; private final static int EXTERNAL = 111; private final static int ATTACH = 11; @Override protected void onCreate(@Nullable

Word document is always Read-Only when opened with Intent

被刻印的时光 ゝ 提交于 2019-11-30 19:02:52
I am trying to open and edit a word document located in my external storage in my Xamarin.Android App with MS-Word with this code: File wordFile = new File(wordFilePath); wordFile.SetWritable(true); FileInfo fileInfo = new FileInfo(wordFilePath); fileInfo.IsReadOnly = false; Android.Net.Uri uri = FileProvider.GetUriForFile(Context, Context.PackageName + ".provider", wordFile); Intent intent = new Intent(); intent.AddFlags(ActivityFlags.NewTask); intent.AddFlags(ActivityFlags.GrantReadUriPermission); intent.AddFlags(ActivityFlags.GrantWriteUriPermission); intent.AddFlags(ActivityFlags

Word document is always Read-Only when opened with Intent

浪子不回头ぞ 提交于 2019-11-30 03:20:26
问题 I am trying to open and edit a word document located in my external storage in my Xamarin.Android App with MS-Word with this code: File wordFile = new File(wordFilePath); wordFile.SetWritable(true); FileInfo fileInfo = new FileInfo(wordFilePath); fileInfo.IsReadOnly = false; Android.Net.Uri uri = FileProvider.GetUriForFile(Context, Context.PackageName + ".provider", wordFile); Intent intent = new Intent(); intent.AddFlags(ActivityFlags.NewTask); intent.AddFlags(ActivityFlags

Can't access the secondary storage (the external removable micro sd card)

左心房为你撑大大i 提交于 2019-11-28 14:46:50
Please read my question introduction before reading the real question: In Android there are an internal storage and an external storage . Don't be confused, because the internal storage relates to files that are accessible only by the app, and the external storage relates to normal files that can be accessed by all apps and can be found both in the real internal storage card (the phone's sd card) and in the real external storage card (the removable micro sd card). My path of the phone's sd card (the one that you can't remove) is: /storage/emulated/0 . My path of the micro sd card (the one that

Can't access the secondary storage (the external removable micro sd card)

落爺英雄遲暮 提交于 2019-11-27 08:43:43
问题 Please read my question introduction before reading the real question: In Android there are an internal storage and an external storage . Don't be confused, because the internal storage relates to files that are accessible only by the app, and the external storage relates to normal files that can be accessed by all apps and can be found both in the real internal storage card (the phone's sd card) and in the real external storage card (the removable micro sd card). My path of the phone's sd