The life cycle of an activity is such that if an activity loses focus, its onPause method is called if you donβt want to, and you still want to lose focus from the activity layout, you have a relative layout that has a width and height that fills the parent element, one has its own the activity layout and the other background layout is transparent, add the ProgressBar to the second layout. first set the visibility of the second layout. and set visible or absent when you want to display or reject the dialog.
source
share