Android Question failure to open text file

Roberto P.

Well-Known Member
Licensed User
Longtime User
Hello to all
someone can figure out where the problem is the failure to create and open a text file?

I attach the project.

thank you
 

Attachments

  • error.png
    error.png
    12.7 KB · Views: 140
  • fileopen.zip
    6.8 KB · Views: 116

DonManfred

Expert
Licensed User
Longtime User
and open a text file?
What exactly you want to archieve?
To open (and read) a file by your app you don´t need a Intent. Just open and read it.

You are trying to open an intent to EDIT the file. But there is no app registered to be the EDITor for .txt files.
 
Upvote 0

Roberto P.

Well-Known Member
Licensed User
Longtime User
Hi Manfred
I want to create a text file and open the default editor to write the user. I have two registered applications that open the text file. Or I expect Android-face view the applications that open the file.

Thank you
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
Change this:
B4X:
Dim aPath As String = File.DirInternal
to this:
B4X:
Dim aPath As String = File.DirRootExternal
or this:
B4X:
Dim aPath As String = File.DirDefaulttExternal
I think files in internal can only be opened by their application, but you are trying to open it with an external program.
 
Upvote 0

Roberto P.

Well-Known Member
Licensed User
Longtime User
I have already tried
File.DirRootExternal but it does not work
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
I ran your program and used rootexternal and defaultexternal and was able to open it with Notepad and quickoffice installed on the device.
 
Upvote 0

Roberto P.

Well-Known Member
Licensed User
Longtime User
the same program?!
I have tried with two tablets with the same error !?
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
The same program you posted except that I added this:
Log(File.ReadString(aPath, sFile))
just to see that the file was saved to either rootext. or defaultext.
 

Attachments

  • RobertoP032216.zip
    6.9 KB · Views: 124
Upvote 0

Roberto P.

Well-Known Member
Licensed User
Longtime User
I thank you, but I have the same error ...
I do not understand!!!
 

Attachments

  • error 2.png
    error 2.png
    13.4 KB · Views: 127
Upvote 0
Top