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

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Fasasoftware
Posts: 203
Joined: Mon Oct 31, 2011 9:36 pm
Location: Italy
Contact:

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

Post by Fasasoftware » Thu May 02, 2013 10:59 am

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:

Klaus
Posts: 13858
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

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

Post by Klaus » Thu May 02, 2013 11:48 am

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

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7257
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

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

Post by jacque » Thu May 02, 2013 5:52 pm

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.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Klaus
Posts: 13858
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

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

Post by Klaus » Thu May 02, 2013 6:37 pm

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...

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7257
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

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

Post by jacque » Thu May 02, 2013 7:16 pm

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. :)
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

CoffeeCone
Posts: 64
Joined: Fri Apr 26, 2013 8:38 am

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

Post by CoffeeCone » Thu May 02, 2013 8:19 pm

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
Learning LiveCode, one step at a time.

Fasasoftware
Posts: 203
Joined: Mon Oct 31, 2011 9:36 pm
Location: Italy
Contact:

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

Post by Fasasoftware » Fri May 03, 2013 12:47 am

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:

CoffeeCone
Posts: 64
Joined: Fri Apr 26, 2013 8:38 am

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

Post by CoffeeCone » Fri May 03, 2013 1:17 am

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.
Learning LiveCode, one step at a time.

Fasasoftware
Posts: 203
Joined: Mon Oct 31, 2011 9:36 pm
Location: Italy
Contact:

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

Post by Fasasoftware » Fri May 03, 2013 7:19 pm

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

Post Reply

Return to “Android Deployment”