What is the best way to show a long file

I have a long (20K) text file that I need to display (a document on the terms and conditions written by a clearly overpaid attorney).

What is the best / easiest way to show this to the user? I downloaded the text from a raw resource and added it as a message in AlertDialog, but the text is cut off by about half. I could not find any obvious restrictions on the text of the warning dialog box or the TextView used.

+3
source share
2 answers

Do you use a Samsung phone? Samsung seems to have found it necessary to add an undocumented 9,000-character limit to its text boxes. According to the answer below, you should be able to get around this by explicitly defining the maximum length with android:maxLength:

How to debug a seemingly hardware-dependent problem with my Android application without access to hardware?

+3
source

put your text in scrollview inside the xml layout file. try something like:

AlertDialog.Builder b = new AlertDialog.Builder();
b.setMessage("Scary Legal Stuff");
b.setView(View.inflate(R.layout.scary_legal_scrollview),null));

Probably the best place for this would be onCreateDialog in your activity.

+1
source

Source: https://habr.com/ru/post/1764083/


All Articles