There is a process that lasts 2 seconds, during the process I need to lock the entire screen and the buttons of the mobile phone. There is a code that disables only the cancellation process.
public void onClick(View view) {
int pos = getAdapterPosition();
dialog= new ProgressDialog(context);
dialog.setMessage("Please wait ...");
dialog.setCancelable(false);
dialog.show();
if(pos != RecyclerView.NO_POSITION){
LanguageRecycler clickedDataItem = mData.get(pos);
SharedPrefManager.getmInstance(context).setCity(clickedDataItem.getAlias());
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
((Activity)context).finish();
}
}, 2000);
}
}