Can you point out what in the B4A is wrong with my logic?
The third conditioin always closes the app with, ** Activity (main) Pause, UserClosed = true **
Just trying to write text files into EditText2.
TIA for sharing.
----------------
The third conditioin always closes the app with, ** Activity (main) Pause, UserClosed = true **
Just trying to write text files into EditText2.
TIA for sharing.
----------------
B4X:
Sub EditText1_EnterPressed
If EditText1.Text = "" Then
EditText2.Text = File.ReadString(File.DirRootExternal, "blank.txt") 'THIS WORKS
ToastMessageShow("No file name was in text box.", True)
Else If EditText1.Text <> EditText1.Text & ".txt" Then
EditText2.Text = File.ReadString(File.DirRootExternal, EditText1.text & ".txt") ' THIS WORKS
ToastMessageShow(" EditText1 had a valid name in it" & ".", True) ' writes a file named aa.txt or bb.txt
' in EditText2
Else
EditText2.Text = File.ReadString(File.DirRootExternal, "zz.txt") ' THIS FAILS
ToastMessageShow(" PLEASE CHECK THE SPELLING OF THE WORD", True)
End If
End Sub
B4X:
Sub EditText1_EnterPressed
Select EditText1.Text = EditText1.Text
Case EditText2.Text <> File.ReadString(File.DirRootExternal, EditText1.text & ".txt") ' THIS WORKS, finds the File
EditText2.Text = File.ReadString(File.DirRootExternal, EditText1.text & ".txt") ' writes a file named aa.txt or bb.txt
ToastMessageShow(" WE'RE ON THE SAME PAGE", True) ' in EditText2
Case EditText1.Text = "" ' THIS WORKS
EditText2.Text = File.ReadString(File.DirRootExternal, "zz.txt")
ToastMessageShow("No file name was in text box.", True)
Case Else
EditText2.Text = File.ReadString(File.DirRootExternal, "zz.txt") ' THIS FAILS
ToastMessageShow(" PLEASE REVIEW ALL ASPECTS IN THE SPELLING", True)
End Select
End Sub
B4X:
Sub EditText1_EnterPressed
If EditText1.Text = "" Then
EditText2.Text = File.ReadString(File.DirRootExternal, "zz.txt") ' THIS WORKS
ToastMessageShow("No file name was in text box.", True)
Return
End If
If EditText1.Text <> EditText1.Text & ".txt" Then ' THIS WORKS
EditText2.Text = File.ReadString(File.DirRootExternal, EditText1.text & ".txt") ' writes q file named aa.txt or bb.txt
ToastMessageShow(" EditText1 had a valid name in it" & ".", True) ' in EditText2
Else
EditText2.Text = File.ReadString(File.DirRootExternal, "zz.txt") ' THIS FAILS
ToastMessageShow(" PLEASE CHECK THE SPELLING OF THE WORD", True)
Return
End If
End Sub