For my app, Diabetic Tracker V2 found here: http://ai2.appinventor.mit.edu/#5299413839773696, I am saving a simple txt file called "DiabeticTracker1.txt" which contains the data that is put in on the main screen. Then there is an option to got to an "All Readings" screen and see the history of the readings taken. I want the user to be able to Share/Send" that file by whatever means they wish.
The problem I'm having is when the Share button is clicked I'm getting the error "ERROR 2001: The file DiabeticTracker.txt could not be found on your device" But it has to be there because screen 3 is reading it and displaying it, right?
I read this forum post getclip ERROR 2001 The file could not be found on your device in which it was suggested that the file path may be incorrect, but I've never set a file path. In the attached pic "save_file_block.png" (if you can see it, I had to zoom out to fit it all on the screen), there is no mention of a save location. When I originally set his up, months ago, I assumed it saved it in the apps folder location automatically because, like I stated, screen 3 can read it and display it without any issue.
I should also mention that the initial "save" is done on screen 1, and it saves 2 files. One is the "All readings" and one is "last reading" which is displayed on screen 1 when you open the app, that way you can see the last time you checked and how much insulin you took.
I can also rule out the naming issue, where DiabeticTracker1.txt is different from diabetictracker1.txt. I've gone through my work and made sure everything was named accordingly.
Any thoughts?
--
the sharing component only can share files from the sdcard, but not from the assets or the private data directory
you could read the file on first run of the app and save it on sdcard, later then append to the file on sdcard and share from there
for the sharing component, use the full path to the file on sdcard, for example file:///mnt/sdcard/DiabeticTracker1.txt
--
That makes sense. Since I'm not specifying where to save it, the file is automatically being saved with the assets or the private data directory and can't be shared.
I will work on it.
--
I need help still. I'm following the reference guide here: http://ai2.appinventor.mit.edu/reference/components/storage.html#File but I notice it doesn't say state the same info for appending a file. For reading and saving it states to add a slash / before the file name: "/myFile.txt will write the file in /sdcard/myFile.txt" but I tried appending all my file names with the slash / and I still can't seem to save it to the sd card.
I thought that maybe the issue was my phone, Lenovo A936, and for some reason Lenovo's version of Android is all screwy, so I tried my girlfriends LG G3 and I'm getting the same issue.
I've attached a screenshot from my Lenovo in case it helps.
--
if you store the file like this /DiabeticTracker1.txt then the full path for the sharing component is file:///mnt/sdcard/DiabeticTracker1.txt
--
Awesome! Thanks for the help!
--
댓글 없음:
댓글 쓰기