storage

How do I save temporary data on android?

拟墨画扇 提交于 2019-12-23 13:20:31
问题 How can I save some temporary data so that when I close the application all the data is gone? I've tried sharedPreferences but it seems that the data is still there when I open up the application once again. I've heard that you can save data to some cache memory, but I really don't want the data to be gone if the memory gets "filled" when the app is still up and running. Maybe I should go with some global variables? Not that I know how I could get that to work. My simple app, which is a "game

Fixtures with Paperclip

巧了我就是萌 提交于 2019-12-23 08:57:19
问题 I'm using Paperclip to store documents, but I can't find how to create fixtures of them, I wrote this : <% doc = Document.create(:asset => File.open(Rails.root.join('spec', 'assets', 'image.png'))) %> <%= part_event_image %>: asset_file_name: <%= doc.asset_file_name %> asset_content_type: <%= doc.asset_content_type %> asset_file_size: <%= doc.asset_file_size %> asset_updated_at: <%= doc.asset_updated_at %> documentable: party (Event) %> <% end %> But one I ran it, the document exist in the

Storing File Sizes in a Database

巧了我就是萌 提交于 2019-12-23 07:06:06
问题 I am currently working on a system that involves storing multiple studies and details of their contents (A study can typically contain 1 < X < ~2000 images). My colleagues and I were discussing what might be the best method of storing files sizes (specifically the image sizes) in a database would be. The file sizes typically range from < 1kB to > 20MB. We are currently debating between storing the images sizes as: # of kilobytes (as an integer value) # of bytes (as a large integer value) # of

Use SharedPreferences to display popup only once

浪尽此生 提交于 2019-12-23 06:18:22
问题 I have the following code in my onActivityForResult method after I add a contact using an intent. if (mySharedPrefs.getBoolean("settingsPopup", false) == false) { //First time new AlertDialog.Builder(this) .setTitle("Go to settings? ") .setMessage("POPUP") .setNegativeButton("No", null) .setPositiveButton("Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { Intent settingsIntent = new Intent(MainActivity.this, Settings.class); startActivity

your reasons to store blobs less than 0.3 MB in database?

北战南征 提交于 2019-12-23 05:43:12
问题 [ 1 ], [ 2 ] and many other references gives conclusion that BLOBs with size less tha 0.3-1 MB should be stored in database while BLOBs larger than 1 MB - in file system (possibly through FILESTREAM). FACEBOOK.com stores 6.5 (30 with thumbnails and size versions) billions pictures in files system [ 3 ]. Randal's white paper [ 2 ] reasons it by: Well, this does not convince me about necessity to store blobs in database but just about the fact that they should not be accessed/streamed

how to use hash function for storing ~4 million images in file system [closed]

青春壹個敷衍的年華 提交于 2019-12-23 05:13:53
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago . I want to store ~1 million images which would be resized into 4 different kinds,so there would be ~4 million images.How should I use hash functions like md5 to evenly and uniquely distribute images in the directory structure? 回答1: As others have noted, multiple file names can

Storing Files on Android that don't get deleted on update or uninstall

。_饼干妹妹 提交于 2019-12-23 02:55:18
问题 I want to store some data to a File (not database) on the Android device. Currently I'm using Context.getFileDir() as the parent directory. However, when you update the app that directory gets deleted. Is there a directory I can use from Context that won't get wacked when the user goes to update the application? Does it have to be the SD Card since that's not always generally available on all phones? 回答1: If you want to file not to be deleted on uninstall is not possible as you might know

unable to create directory in external storage

风格不统一 提交于 2019-12-23 02:02:04
问题 I wanted to the application to create a new directory to store downloaded image inside sdcard. I tried a few methods but still I can't seems to get it work. I included permission for External Storage in android manifest as well. Any comments will be appreciated. Bitmap bm = null; InputStream in; in = new java.net.URL("http://blogs.computerworld.com/sites/computerworld.com/files/u177/google-nexus-4.jpg").openStream(); bm = BitmapFactory.decodeStream(new PatchInputStream(in)); File file = new

HTML5: “local storage” and “sqlite storage” Limits

。_饼干妹妹 提交于 2019-12-23 01:44:38
问题 I have seen posted limits on client-side storage: LocalStorage: sizes are 5MB Sqlite storage: 5MB expandable by user request. First, are these numbers still correct? ...and how about "sessions storage" too? Secondly, are these storage schemes mutually exclusive? ... or is this limit an aggregate of all client-side storage - LocalStorage, SessionStorage, Cache (via manifest) and Sqlite data. Thanks for your help. Greg 回答1: As per my knowledge that 5mb shared across local storage,session

Saving camera data to cache when launched via intent

孤者浪人 提交于 2019-12-23 01:12:54
问题 I am launching the Camera application via an Intent and saving the image temporarily to the SD card using the EXTRA_OUTPUT option. The URI passed needs to point to a location on external storage. I also need to provide a URI if I want the full-size image to be returned. I would like to account for the fact that the user might not have an SD card mounted. It is my understanding that due to the security measures Android imposes, the Camera application does not have write permissions to my