Created
April 14, 2024 10:32
-
-
Save VahidHoseini-ir/c991b43f972cea10f961fe92d7284ea1 to your computer and use it in GitHub Desktop.
sample using of progrees dialog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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