2

I know I'm getting crazy.

I tried to print all 4032 factors of 15! (in full decimal representation) into a textView, and the app got frozen for about 10 seconds.

I tried to print all 14688 factors of 18! (in full decimal representation) into a textView, and the app got frozen for over a minute.

I tried to print all ??? factors of 20! (in full decimal representation) into a textView, and the app got frozen forever.

So is there a size limit of textView? Did I hit the limit so the app got frozen?

EDIT: I timed the factorization and factor-building processes. They are both lightning fast - under 1 second. So I assume the problem is textView?

Nissa
  • 215
  • 1
  • 7
  • I have experienced issues calling `setText()` with large amounts of content on certain GPUs before. The question I posted is [here](http://stackoverflow.com/questions/29801232/edittext-performance-understanding-gpu-process-time-on-profile-gpu-rendering), with some partial solutions. It may apply to your situation. – PPartisan Aug 11 '15 at 18:40
  • I don't think the problem is the textview. maybe the operation is too big for the phone. – Kamila Brito Aug 11 '15 at 18:42
  • PPartisan: Yes this is exactly the problem I had (well, I tried to print out more content at once than you). Going to try if your solution works. – Nissa Aug 13 '15 at 11:35

1 Answers1

3

Your app froze not because you've reached the limit of the TextView, but because you were calculating all the factors of 20 on the Main, UI thread - the same used to render the TextView.

You should do all heavy calcuations on a background thread and pass the result to the UI thread once done, to update the TextView.

  • 1
    : I timed the factorization and factor-building processes. They are both lightning fast - under 1 second. For both 15! and 18!. So I assume the problem is textView? – Nissa Aug 11 '15 at 18:41
  • Well, if you really want to test this you could add each factor as a list item and display them in a ListView, since the ListView doesn't load all views at once but only the ones currently displayed. This way you can tell if its the factor calcuation or the TextView causing the freeze –  Aug 11 '15 at 18:42