Skip to content

Instantly share code, notes, and snippets.

@VahidHoseini-ir
Created April 14, 2024 10:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save VahidHoseini-ir/c991b43f972cea10f961fe92d7284ea1 to your computer and use it in GitHub Desktop.
Save VahidHoseini-ir/c991b43f972cea10f961fe92d7284ea1 to your computer and use it in GitHub Desktop.
sample using of progrees dialog
private void showProgressDialog() {
ProgressDialog progressDialog = new ProgressDialog(this);
progressDialog.setTitle("Progress Dialog");
progressDialog.setMessage("Loading...");
progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
progressDialog.setCancelable(false);
progressDialog.show();
// Simulate a long-running task
new Handler().postDelayed(() -> {
progressDialog.dismiss();
Toast.makeText(MainActivity.this, "Task completed", Toast.LENGTH_SHORT).show();
}, 3000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment