storage

Android saving data in Internal Storage NullPointerException

隐身守侯 提交于 2019-12-22 18:13:57
问题 I have a little problem with writing a file in internal storage from my application.I'm gettin a null pointer exception,but can't find the way to fix it..and actually can't understand which one of the elements is null. Here is the code that I'm using : hash= jsonObj.getString("hash"); Log.w("CLIENT AUTH HASH","SHOW CLIENT AUTH HASH : "+hash); FileOutputStream out = context.openFileOutput("autohash",context.MODE_PRIVATE); out.write(hash.getBytes()); out.close(); The class where I'm trying to

Storing large numbers of varying size objects on disk

旧时模样 提交于 2019-12-22 11:28:08
问题 I need to develop a system for storing large numbers (10's to 100's of thousands) of objects. Each object is email-like - there is a main text body, and several ancillary text fields of limited size. A body will be from a few bytes, to several KB in size. Each item will have a single unique ID (probably a GUID) that identifies it. The store will only be written to when an object is added to it. It will be read often. Deletions will be rare. The data is almost all human readable text so it

Environment.getExternalStorageDirectory().getAbsolutePath() not working and giving /storage

雨燕双飞 提交于 2019-12-22 10:44:19
问题 My code myDb = openOrCreateDatabase("/sdcard/FashionGirl/ImagesDB.db", Context.MODE_PRIVATE, null); myDb = openOrCreateDatabase(dbPath, Context.MODE_PRIVATE, null); worked perfectly, but was giving warning Do not hardcode "/sdcard/"; use Environment.getExternalStorageDirectory().getPath() instead So I tried, String dbPath = Environment.getExternalStorageDirectory().getAbsolutePath() + "FashionGirl/ImagesDB.db"; myDb = openOrCreateDatabase(dbPath, Context.MODE_PRIVATE, null); But strangely,

Android: download file from internet using DownloadManager and save it to the internal memory

走远了吗. 提交于 2019-12-22 09:05:43
问题 I am downloading a file from the web to my Android device using DownloadManager . I am saving this file on the sdcard using: DownloadManager.Request req = new DownloadManager.Request(Uri.parse("file path")); req.setTitle("file title").setDescription("Downloading ....") // download the package at the /sdcard/download path. .setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, "file name"+ "file extension"); I want to save it to the internal storage. How to do that? 回答1: use this

Listen for harware change events from the linux kernel or udev

早过忘川 提交于 2019-12-22 08:00:05
问题 I need to run some code on storage device mounting and unmounting. How can i listen for these events on linux? I was thinking on adding some udev rules to run some script (any know-how in this matter is appreciated). But I would much rather listen for events from the kernel in some netlink socket with my daemon (just like udev does) or something like that. 回答1: You can use libudev or the more convenient, glib based gudev to monitor udev events in C. 回答2: You have to listen to the "uevent"

How to save a text file in external storage in ios using flutter?

梦想的初衷 提交于 2019-12-22 07:28:09
问题 I have created an app in which user can create and save a text file in the local storage of Android. I have used path_provider package which gives getExternalStorageDirectory() to save the data in the external storage. But I can not find the same for ios . getExternalStorageDirectory() is not supported for ios. I want to save the file so that user can later on access the file from Files app in ios. Future<String> get _localPath async{ var dir = await getExternalStorageDirectory(); return dir

Using external storage, getting error while deleting a folder

让人想犯罪 __ 提交于 2019-12-22 07:00:11
问题 I'm using docker nextcloud. I created a clean instance and I want to use the application external storage. I managed to configure successfully a local storage using the following command : mount_id=$(docker exec --user 1000 nextcloud php occ files_external:create Home local null::null -c datadir=/var/www/data --output=json) docker exec --user 1000 nextcloud php occ files_external:applicable --add-user=foo "$mount_id" I can create/move/copy folder and files but when I want to delete a created

How to create hidden directory in android?

心已入冬 提交于 2019-12-22 05:53:13
问题 I am working on an application where I have created some directory which I am accessing through my application I want to make that directory hidden for security purpose .Such that the user can access them only within the application does not access them outside the application as like through file manager. Any help is appreciated. Don't make it duplicate because I search out all the answer, but no one has worked for me. 回答1: Just appending a dot before the folder name will not protect it . It

How to create hidden directory in android?

假装没事ソ 提交于 2019-12-22 05:53:05
问题 I am working on an application where I have created some directory which I am accessing through my application I want to make that directory hidden for security purpose .Such that the user can access them only within the application does not access them outside the application as like through file manager. Any help is appreciated. Don't make it duplicate because I search out all the answer, but no one has worked for me. 回答1: Just appending a dot before the folder name will not protect it . It

App install size the same on different device types

北战南征 提交于 2019-12-22 05:26:32
问题 When I install my app on my main/new phone, the installed size is around 18.5MB and when I install my app on an old Samsung Galaxy Ace (Mk1), for some reason, it installs with pretty much the same size, as you see here: It runs perfectly on my main phone, but obviously, the old Galaxy Ace really struggles with it. Now, I download a random game from the Play Store and with that one you can see the results here: Much better, it takes up less space on the less capable phone than it does on the