Nissa
Nissa

Reputation: 215

Is there a size limit of textView?

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?

Upvotes: 2

Views: 120

Answers (1)

user2213590
user2213590

Reputation:

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.

Upvotes: 3

Related Questions