2014년 11월 29일 토요일

word editor

so i'm trying to make a text editor on android ,the problem i'm stuck with save and re showing the files i just created ,i succeded in saving them but dont know how to re show them on my app,basically i'm stuck with the File component of app inventor so if u have any idea on how to completely deal with it please help me out 



If you do not share a screen capture image of your blocks showing what you tried, members of the forum can not provide specific advice Mohamed.  Please post some block images and you should get some help.

To 'show' them, you should have a File1.GotText  block    and a File.ReadFrom block somewhere in your code.  Do you have those blocks?



yea i managed to save my text but to reshow the file i just saved i failed to do that,i'm really sorry not showing any screen shots my laptop is kinda crappy i barely keep it going ,can't do alot of stuff on it :D
so i tried to show the files i saved in a list and show this list in a new screen where i can read from ,and this what i created so far :D and i know it is a BIG MESS 

I think you are making this too complicated.     Here are a few examples using the File control with text:







Why are you attempting to re-initialize?   You should not have to do that.    Have you tried reading from the fileName where you just include the file name?        The ListView block seems very wrong.   Is the file you are attempting to load comma separated..   To debug this, I would disable the ListView block  (right click then select disable)  and temporarily try to load the File you are working with using the direct path.  Be aware, if you have this file in Media/resources,   you can not modify it.   The path has to be to a location on the sdCard.



i know about the use of direct path but i don't understand what is the got text method used for ? and if i'm going to use the direct path would it be for several files in the same place or for only one file,and how can i set the path without the application being yet installed? or all the pathes is /sdcard/data ??
i will try that out ...



see this example how to work with the File component How to append text to a file stored as asset in App Inventor
it also helps to take a look into the documentation http://ai2.appinventor.mit.edu/reference/components/storage.html#File

ReadFrom(text fileName)
Reads text from a file in storage. Prefix the filename with / to read from a specific file on the SD card. for instance /myFile.txt will read the file /sdcard/myFile.txt. To read assets packaged with an application (also works for the Companion) start the filename with // (two slashes). If a filename does not start with a slash, it will be read from the applications private storage (for packaged apps) and from /sdcard/AppInventor/data for the Companion.

GotText(text text)
Event indicating that the contents from the file have been read.


first do the tutorials http://appinventor.mit.edu/explore/ai2/tutorials.html to learn the basics of App Inventor, then try something and follow the


댓글 없음:

댓글 쓰기