Here is an example of creating the progress dialog:
First situation:
private ProgressDialog progressDialog;
btnCircle.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
progressDialog = ProgressDialog.show(MainActivity.this,
"Loading", "Please Wait");
SporednaDretva sd = new SporednaDretva(progressDialog, false);
sd.start();
}
});
Please notice that here I have "progressDialog = ProgressDialog.show(MainActivity.this, "Loading", "Please Wait");"
Second situation:
btnProgress.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
progressDialog = new ProgressDialog(MainActivity.this);
progressDialog.setMessage("Downloading");
progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
progressDialog.show();
SporednaDretva sd = new SporednaDretva(progressDialog, true);
sd.start();
}
});
Here I have "progressDialog = new ProgressDialog(MainActivity.this);"
QUESTION: Can anyone explain to me a little bit about these 2 ways of creating a progress dialog? I know that the first dialog is circle dialog and second is horizontal progress dialog, but why in the first example I have "progressDialog = ProgressDialog.show(MainActivity.this, "Loading", "Please Wait")" without new ProgressDialog() and in the second example I have new ProgresDialog()?