Android has a Predefined class for a progress bar, its in a class called ProgressDialog. It looks like this:
You can add this codes in your onCreate() and set the state of the progressDialog like this:
ProgressDialog progress = new ProgressDialog(this);
Also add this following code to a background Thread.
private class ProgressThread extends Thread {
private ProgressDialog progress;
public ProgressThread(Context context, ProgressDialog progress) {
progress.setMessage("Downloading Music :) ");
progress.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
progress.setIndeterminate(true);
}
public void run() {
// update progressbar here
}
}
For more details you can check the Android API Documentation here
This site has a full application demo about it, you might want to check it out.