tags:

views:

70

answers:

2

I have a lengthy (20K) text file I need to display (the terms and conditions document written by an obviously overpaid lawyer).

What's the best/simplest way to show this to a user? I loaded the text from a raw resource and added it as the message to an AlertDialog, but the text is cut off about half way. I couldn't find any obvious limits to the alert dialog text or the TextView it uses.

+2  A: 

Are you using a Samsung phone? It seems like Samsung saw fit to add an undocumented limit of 9000 characters to their text fields. According to the answer below, you should be able to work around that by explicitly defining the maximum length with android:maxLength:

http://stackoverflow.com/questions/3508831/how-can-i-debug-a-seemingly-hardware-dependent-issue-with-my-android-app-without/3577934#3577934

EboMike
Yes it is a Samsung (Epic). I can't believe that was the problem, but your suggested worked.
dhaag23
Yeah, pretty stupid, huh? Samsung has a way of making completely useless changes. Glad it worked out for you though.
EboMike
+1  A: 

put your text in a scrollview inside an 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 to do it would be onCreateDialog in your activity.

schwiz
Even with this I still had to explicitly set the maxLength.
dhaag23