I haven't worked with my app for a few weeks but today a new user was unable to open a file (txt) from his sd card. So until I can find out why, I had him email the file and I inserted it into the IDE files, then created another apk for him, thinking the file would be transferred. To my surprise, the file was not there or at least I could not find it as an internal file when the app was opened on my device or emulator. I also have a 'sample.txt' file and it was there so I am not clear on why the new one wasn't found. I even created another simple comma-delimited txt file, put it in the ide files and on the sd but oouldn't find it again.
Here is the code when the 'Find' button is pressed:
Here is the code when the 'OK' button is pressed:
I have attached a screen shot of the opening screen where this takes place. Can anyone see a problem or where I may have missed something? All of this has been done without connecting to a usb...just using the device. The files are on the sd card per the device's file manager but they don't show up when I select the sd check box on the screen. Maybe I can move files from the sd to internal via usb? I'm almost certain this worked properly before. My user and I have the same device.
Thanks for any help.
Jim
Here is the code when the 'Find' button is pressed:
B4X:
Sub btnFile_Click
Dim text As String
Dim fd As FileDialog
Dim bmp As Bitmap
fd.FastScroll = True
If chksd.Checked =True Then
fd.FilePath = File.DirRootExternal ' also sets ChosenName to an emtpy string
Else
fd.FilePath=File.DirInternal
End If
fd.FileFilter = ".txt" ' for example ".txt" for a specific type of file
ret = fd.Show("B4A File Dialog", "Select", "Cancel", "", Null)
ln=fd.ChosenName .Length
txtfilename.Text =fd.ChosenName.SubString2 (0,ln-4)
End Sub
B4X:
strfilename=txtFileName.text & ".txt"
If File.Exists (File.DirRootExternal,strfilename)=True Then
Msgbox("This file is on the sdcard" ,"File location")
File.Copy(File.DirRootExternal,strfilename,File.DirInternal ,strfilename)
'delete the file from the sdcard. it will remain in internal
File.Delete (File.DirRootExternal ,strfilename)
writer.initialize(File.OpenOutput (File.DirInternal ,strfilename,True))
Else
writer.initialize(File.OpenOutput (File.DirInternal ,strfilename,True))
End If
I have attached a screen shot of the opening screen where this takes place. Can anyone see a problem or where I may have missed something? All of this has been done without connecting to a usb...just using the device. The files are on the sd card per the device's file manager but they don't show up when I select the sd check box on the screen. Maybe I can move files from the sd to internal via usb? I'm almost certain this worked properly before. My user and I have the same device.
Thanks for any help.
Jim