I got main Activity
that on button press starts other class named Getter and that Getter class creates 1-60 000 threads (which do network stuff), so it takes some time until they all are completed. My problem is that when I rotate my device while those threads are running, my program stops working correctly. In my main Activity I have handler that every 2 seconds gets an array from Getter class and then puts those values into local array list.
I tried this solution:
Background task, progress dialog, orientation change - is there any 100% working solution?
but found it very complicated. So now I am wondering if there is any other solution to my problem. For instance can my threads continue running in background even if my orientation changes? If that is not possible can I programatically lock orientation to the one it was just before button was pressed, then wait until threads have completed then again make orientation to go with sensor?