Is there a simple way to disable a user interacting with an activity. To be done when there is an action running (and a spinning progress bar in the title bar)
EDIT:
I solved this by adding an full screen blank image with a null click handler at the end on the XML layout.
Create a transparent PNG file in the drawables folder.
Add a full screen ImageView at the end of the XML layout referencing the image:
...
Add the null click hander for the image to capture user touches:
public void doNothingClick(View v){
// do nothing with the click
}
Add the code to disable the user touches:
private void StopTouches(int duration){
findViewById(R.id.imgMask).setVisibility(View.VISIBLE);
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
findViewById(R.id.imgMask).setVisibility(View.GONE);
}
}, duration);
}