O
O
orbit0702019-05-16 04:40:12
Android
orbit070, 2019-05-16 04:40:12

What is "common" to do when changing device orientation during an active http request?

There is an activity with one button "Get data from the Internet".
I press the button, the request starts, I rotate the screen -> the current activity is destroyed.
Question: do I need to re-launch the request in a new re-created activity or do I need to use some other methods so that the request is not interrupted? If the second option, then please tell me exactly how it should be done, at least approximately. Thanks a lot

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Varakosov, 2019-05-16
@orbit070

You do ViewModel and in it request. https://startandroid.ru/ru/courses/architecture-co...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question