I've been reading the documentation about using files (here) and I have some questions:
1. In "
SaveFile(text text, text fileName)"
it says "
If the filename begins with a slash (/) the file is written to the sdcard". What if the device doesn't have an sd card? My android doesn't (yet).
2. In "
SaveFile(text text, text fileName)"
it also says "If the filename does not start with a slash, it will be written in the program's private data directory where it will not be accessible to other programs on the phone." So, if I can't write files to the sd card, how do I create files accessible to other apps?
3. If I can write files to the sd card, can the user of the phone attach the files to emails?
4. If a user emails a file to another device, how can they get the file to an AppInventor app on that device so the app can read it?
5. How large can a text file be?
I think that's it. Thanks!
--
1) it is the internal sdcard
I think that's it. Thanks!
--
1) it is the internal sdcard
2) see 1)
3) yes
4) usually you would upload a file to the internet and provide a download url for other users
5) I don't know, this depends most probably on the device
Thank you so much!
I never knew there was an internal SD. Cool!
4) The file is created by the app on one device and read by the app on a different device. The files are unique because they depend on the values the user of the app has set. So providing a download url for all or most of my users wouldn't work.
I never knew there was an internal SD. Cool!
4) The file is created by the app on one device and read by the app on a different device. The files are unique because they depend on the values the user of the app has set. So providing a download url for all or most of my users wouldn't work.
--
5) A text file can be really large with respect to the amount of data it contains. The entire text of Treasure Island, by Robert Louis Stevenson can exist in a single text file. In paper print, Treasure Island is a large book, over 300 pages and 34 chapters in six parts. Of course there is a finite limit, I think somewhere I read the file size is limited to 2 Mb. That is an incredible amount of plain text.
--
Why don't you find a really large *.txt file and load it and see what happens. Also note, after loading it either as a Resource or as a File, you can probably display the ENTIRE text in a single Label. Really.
This entire text file will can be loaded into a Label http://www.gutenberg.org/cache/epub/120/pg120.txt ; it is about 382 Kb ...or you could load it in html format (no images) at a size of about 500kb saved as a resource and read with a WebViewer.
The entire code for the text version is:
and with a little editing could look like the above displayed in a label. Be aware, there is a lot of manual formatting.
The html version of the file would look like
when displayed. Remember, no images otherwise the html becomes huge immediately. Here you have formatting already and COLOR.
Either of these could be saved as plain txt or an html and shared using Firebase or dropbox perhaps.
Awesome awesome awesome! Thanks!
As for the images. I'm writing a HTML file (with images) and then viewing it through the webviewer. About how many images (like 1 inch by 3/4 inch) do you think I'd be able to squeeze? I'm trying that out right now... Well, trying to.
As for the images. I'm writing a HTML file (with images) and then viewing it through the webviewer. About how many images (like 1 inch by 3/4 inch) do you think I'd be able to squeeze? I'm trying that out right now... Well, trying to.
--
The way most developers find out the limits of their programming tools is by experimenting and pushing them to the limit. The image size 1inch x 3.4 is not the issue, what counts is the number of pixels by pixels and the overall Kb or Mb of the individual image file. A limit you face is that the ENTIRE size of your app plus the html is going to have to be under 10Mb unless you import the html outside of Media/Resources. So, if the size of the html plus images is larger than 10Mb, you won't be able to store it in Media.
Use png images rather than jpg ...they occupy less space and are generally more forgiving when upsizing or downsizing..
Let us know how your experiments work out.
--
Okay, thanks! When you get an image from the web (src="http://...) or from the device (filepath), does that count toward the app size?
Sorry. The answer is probably pretty obvious, but I just can't figure it...
Sorry. The answer is probably pretty obvious, but I just can't figure it...
--
That depends.
If you include the asset as part of your app, then it will count toward our 10 MB limit for compiling apps. If you download the asset and store it on the internal storage, it won't count* toward the limit. Similarly, using a URL will not count toward the package limit*. However, this does not get you out of any runtime limits imposed by the operating system when you actually go to use those images.
* Technically the path or URL is in the code and thus counts toward the size of the app, but it is negligible in size compared with the image.
--
--
Okay, awesome; thanks! I will be conscientious of the runtime limits. Thank you so much!
--
--
댓글 없음:
댓글 쓰기