fed / Yamba

Yet Another Micro Blogging App
0 stars 0 forks source link

Display a spinner while fetching posts #11

Open fed opened 9 years ago

fed commented 9 years ago

Use the ProgressDialog class (which extends AlertDialog). Right now we only have a Loading data... message when fetching data from the API.

// To show the spinner
ProgressDialog progress = new ProgressDialog(this);
progress.setTitle("Loading");
progress.setMessage("Wait while we fetch the latest posts to update the timeline...");
progress.show();

// To dismiss the dialog
progress.dismiss();

Shortcut:

ProgressDialog.show(this, "Loading", "Wait while we fetch the latest posts to update the timeline...");

More info here: http://developer.android.com/reference/android/app/ProgressDialog.html

Side note: Even though I used Spinner on the title, it has a different meaning in Android, it's more like a select field in HTML.