Page 1 of 1

How To open a file txt or rtf in Android??

Posted: Thu May 02, 2013 10:59 am
by Fasasoftware
Dear friend... i need to know How To open a file txt or rtf in Android....because i have don't seen in any document....

I need a script like this......

Code: Select all


on mouseUp
     if the platform is "android" then 
        answer file "A text file" with type ("text files|txt|tTXT" & return & "rtf files|rtf|tRTF" & return & "all files|*|*")
        if it <> "" then
            put it into theFilePath
            put URL ("file:" & theFilePath) into field "testfield"
 

        else
            --no file was selected, or cancel was pressed
            beep
        end if
end if
    end mouseUp


but this one don't work in android.....

Can somebody help me please???

Best regards,

Lestroso :oops:

Re: How To open a file txt or rtf in Android??

Posted: Thu May 02, 2013 11:48 am
by Klaus
Buongiorno Lestroso,

sorry for the bad news, but as the dictionary told me, "anser file..." is only available on the desktop on
Mac, Win and Linux, because iOS and ANDROID do not have a "browsable" filesystem like desktop machines.


Best

Klaus

Re: How To open a file txt or rtf in Android??

Posted: Thu May 02, 2013 5:52 pm
by jacque
At least, they aren't browsable by LiveCode on my Android tablet. I have several Android apps that do open a folder/file list and allow you to select a file. I wish I had access to that.

Re: How To open a file txt or rtf in Android??

Posted: Thu May 02, 2013 6:37 pm
by Klaus
And you can really "browse" the file system?

One could of course "fake" this file dialogs by setting "the folder" and getting/displaying all the files in it.
But that will require that you know all the folders you want to access...

Re: How To open a file txt or rtf in Android??

Posted: Thu May 02, 2013 7:16 pm
by jacque
Yes, I can browse the file system. For example, my ebook reader opens a file browser and lets me select an epub to import. There are also many third-party file managers you can install, and Android comes with a basic built-in one. Those act like Finder and let you see all the files in the system. I can move, copy, delete, rename files, etc.

So I know Android has the capability, but we just don't have access to it in LiveCode...yet. :)

Re: How To open a file txt or rtf in Android??

Posted: Thu May 02, 2013 8:19 pm
by CoffeeCone
Hi FasaSoftware,

I got interested in this topic and wanted to see if I can have a go at making a very basic file manager for Android. The result is the attached zip file. I included the apk file so you can test it out. Basically, it implements the idea of selecting files and navigating the Android file system.

Here's how it works:
On the list field, you tap or highlight the folder you want to visit. That folder is opened and you are shown what's inside (like an actual file picker). The folder path is shown on the small field on the lower right side. If you wish to go up one folder level, you press the Go Up button. The "Open" button will only enable if you have selected a file instead of a folder. When you press the Open button, it will show via alert box the path to your selected file.

This was a very interesting challenge and it gave me more knowledge for LiveCode. Hopefully it helps you out with the basic idea of implementing your own file picker. :)

It's too big to attach so I uploaded it elsewhere: http://www.mediafire.com/download.php?rfzg2xgmdo4ntdm

I've tested it on a rooted ICS 4.0.4 phone but I don't think that matters though.
Image

Re: How To open a file txt or rtf in Android??

Posted: Fri May 03, 2013 12:47 am
by Fasasoftware
Thank you Coffee cone......and many thank to everybody,,,

But this is a big problem!!!! I have tested your app but unfornetly is unusable....Ok i listing the file.... but i can't open anything..... you have used answer script in the open button...


using put url????



So can I open in other manner open a text files??? when it will be this instruction??? We need very much....


Any other idea???

Thanks a lot..

lestroso :oops: :oops:

Re: How To open a file txt or rtf in Android??

Posted: Fri May 03, 2013 1:17 am
by CoffeeCone
Fasasoftware wrote:Thank you Coffee cone......and many thank to everybody,,,

But this is a big problem!!!! I have tested your app but unfornetly is unusable....Ok i listing the file.... but i can't open anything..... you have used answer script in the open button...


using put url????



So can I open in other manner open a text files??? when it will be this instruction??? We need very much....


Any other idea???

Thanks a lot..

lestroso :oops: :oops:
Hi, this is a substitute for answer file on the Android platform. It is simply to show how it works. You have to implement it into your own project. You can base the code off of what I made.

When you click on Open, the file path is supposed to be shown to you. That should be your cue. :)

I might make it a library stack but that is for when I have the necessary time to convert it. For now, you can study the code for proper implementations.

Re: How To open a file txt or rtf in Android??

Posted: Fri May 03, 2013 7:19 pm
by Fasasoftware
I thank you again coffee Cone......

but i don't know how use your script.......because i need to open a text in some manner...... but i have got an idea...I put a command that copy the text to and from an ebook for example....

I tahnk you again....
ù

best regards,

Lestroso :D