Show progress bar with application shutdown

I have a ListActivity that triggers another action based on a list selection. This second activity should load data by analysis from the xml file and, as such, there is a noticeable delay between when the user clicks on the element and when the Activity is displayed.

Between this process, the user must indicate a progress bar at the bottom of the screen with the activity turned off.

+4
source share
2 answers

You should take a look at the AsyncTask class, which allows you to perform background processing and publish processing status without stopping the main activity.

+4
source

Whenever you use some graphics library, this concept will exist: you have one thread that is designed for graphical interfaces, in Java-Swing, called the "Event Manager" EDT , in Android, and also in SWT, it is called UI -Thread. This thread is responsible for all GUI events and manipulations. Long-running actions must be performed in another thread, so the user interface does not block / freeze.

(I think it’s important to understand this basic concept of user interface development, and not just use AsyncTask and think that this is something special for Android)

EDIT

+2
source

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


All Articles