Making Progress

 

If you need to be doing something for a long period of time, you owe it to your users to do two things:

• Use a background thread, which will be covered in Chapter 15

• Keep them apprised of your progress, or else they think your activity has wandered away and will never come back

The typical approach to keeping users informed of progress is some form of progress bar or “throbber” (think the animated graphic towards the upper‑right corner of many Web browsers). Android supports this through the widget.

A keeps track of progress, defined as an integer, with 0 indicating no progress has been made. You can define the maximum end of the range – what value indicates progress is complete – via . By default, a starts with a progress of 0, though you can start from some other position via .

If you prefer your progress bar to be indeterminate, use , setting it to true.

In your Java code, you can either positively set the amount of progress that has been made (via ) or increment the progress from its current amount (via ). You can find out how much progress has been made via .

Since the is tied closely to the use of threads – a background thread doing work, updating the UI thread with new progress information – we will hold off demonstrating the use of until Chapter 15.

 








Дата добавления: 2015-05-16; просмотров: 661;


Поиск по сайту:

При помощи поиска вы сможете найти нужную вам информацию.

Поделитесь с друзьями:

Если вам перенёс пользу информационный материал, или помог в учебе – поделитесь этим сайтом с друзьями и знакомыми.
helpiks.org - Хелпикс.Орг - 2014-2024 год. Материал сайта представляется для ознакомительного и учебного использования. | Поддержка
Генерация страницы за: 0.004 сек.