How to handle activity when orientation changes?

I am writing an action that downloads data from a server and displays it as a list using the ArrayAdapter. To do this, I show the execution dialog, load while it downloads all the data from the server. Then I delete the dialog in the handler. My problem is that when I change orientation, the progress dialog is displayed again, which is not required because all the data is already displayed?

+3
source share
1 answer

I would say that you have two options:
Either you force your activity not to change orientation:

<activity android:name="MainActivity" android:configChanges="keyboardHidden|orientation"> 

(), , , . onPause() onSaveInstanceState(), Android, , , . .

, , . , AsyncTask , AsyncTask.getStatus, . , .

+5

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


All Articles