Progress Bar Instead Progress Dialog

Rajan Maurya
2 min readApr 6, 2019

--

As we know Progress Dialog is depreciated in API level 26

Reference: https://developer.android.com/reference/android/app/ProgressDialog

because It prevents the user to interact with the app. Let me explain to you why this is bad. As we show the Progress Dialog It runs and blocks the UI and user can’t interact with the App. Until our request is successful or fails basically we get the response of the request whatever we started.

Like Example suppose we are fetching some list of data in Navigation drawer home and started showing the Progress Dialog and as you know It will block the UI and User can’t do anything. Ever user can’t open navigation drawer and choose something else etc things. App UI is blocked, no interaction.

So Now what we have Progress Bar. Let’s make something that will not block UI and make UI interaction really cool.

What about if we show the Progress Bar and Small Text message below and with 80% white color transparency in the background of the layout.

and wherever you are doing normal work. You can show only the Progress bar. So let’s talk about implementation. It’s really easy. You need to create a layout

and Add it to your layout in which you want to show it.

Now you are done. Isn’t it simple?

and Go to your Kotlin file and to show the Progress Bar layout

llProgressBar.visibility = View.VISIBLE

and To hide

llProgressBar.visibility = View.GONE

Hope you enjoyed the Post. It’s really just for fun. Have a nice day!!!!!

--

--

Rajan Maurya

Senior Software Engineer at OpenLane Inc, Open source contributor at Mifos Initiative and mentoring GSoC Students. https://github.com/therajanmaurya