To Erel, Martin, and Guru friends,
I’m trying to load a `.txt` file into a multiline `EditText` in B4A.
I’ve used `File.ReadString(...)` and assigned it to `EditText.Text`, but the content doesn’t appear or only partially loads.
Here’s what I’ve already tried:
- Used `Activity.LoadLayout(...)` before assigning the text
- Tested with files in both `File.DirInternal` and `File.DirAssets`
- Verified UTF-8 encoding
- Requested all permissions: `READ_EXTERNAL_STORAGE`, `MANAGE_EXTERNAL_STORAGE`, SAF
- Tried `WebViewExtras 2.20` (Martin’s library)
- Used `Phone.SdkVersion` to request `READ_MEDIA_IMAGES`, `READ_MEDIA_AUDIO`, `READ_MEDIA_VIDEO` for Android 13+
- Tried displaying with `Label.Text` — works, but `EditText` does not
- Tried `WebView` — limited scroll/zoom
Could you please provide:
1. A working example of `Main.bas` that loads a `.txt` file into a multiline `EditText`
2. The correct `manifest.xml` entries for Android 11 and above
3. A list of required libraries
4. Any better approach to display long text from a file (e.g., WebView, CustomListView)
Thanks,
varayut
I’m trying to load a `.txt` file into a multiline `EditText` in B4A.
I’ve used `File.ReadString(...)` and assigned it to `EditText.Text`, but the content doesn’t appear or only partially loads.
Here’s what I’ve already tried:
- Used `Activity.LoadLayout(...)` before assigning the text
- Tested with files in both `File.DirInternal` and `File.DirAssets`
- Verified UTF-8 encoding
- Requested all permissions: `READ_EXTERNAL_STORAGE`, `MANAGE_EXTERNAL_STORAGE`, SAF
- Tried `WebViewExtras 2.20` (Martin’s library)
- Used `Phone.SdkVersion` to request `READ_MEDIA_IMAGES`, `READ_MEDIA_AUDIO`, `READ_MEDIA_VIDEO` for Android 13+
- Tried displaying with `Label.Text` — works, but `EditText` does not
- Tried `WebView` — limited scroll/zoom
Could you please provide:
1. A working example of `Main.bas` that loads a `.txt` file into a multiline `EditText`
2. The correct `manifest.xml` entries for Android 11 and above
3. A list of required libraries
4. Any better approach to display long text from a file (e.g., WebView, CustomListView)
Thanks,
varayut