Substitute for ProgressDialog

1

In my apps I used Progress Dialog but I read that it is deprecated from the O API.

According to this link

I wanted to know which component can be a replacement for it, since I used it as follows.

progressDialog = ProgressDialog.show(this, "Aguarde.",
            "Processando..!", true);

And in a certain part of the code where I would have known that it had already been processed,

progressDialog.dismiss();

I was reading about Progress Bar but she does not work that way or does she work?

    
asked by anonymous 12.07.2017 / 14:23

1 answer

1
  

I wanted to know which component can be a substitute for it (.).

The suggested replacement is ProgressBar . Both ProgressDialog and ProgressBar , have existed since the initial version of Android.

  

I was reading about Progress Bar but does not it work that way or work?

Yes, if it refers to the possibility of starting and stopping it. The difference is that one is a dialog while the other is displayed "inside" the layout .

ProgressDialog was considered obsolete on Android O (Api Level 26) which, on this date, is the latest version. The fact that it is considered obsolete does not imply that it can not be used.

The main reason, in my opinion, for ProgressDialog to be considered obsolete, has to do with user experience - the presentation of a dialog limits user interaction with the application, while task is running.

See the question Best practices when displaying the loading screen on Android , where Luiz Vieira in his answer , addresses the issue from a "usability" perspective. In my answer , you can find an example of using ProgressBar.

    
12.07.2017 / 15:29