Android Progress bar not hiding

I have a toolbar in my Android app where, when a user clicks a button, preogressDialog ("Please Wait") opens and the next activity loads. But when I press the bacj button of the Android device, a progress indicator is still displayed. I used firing (), but to no avail. Any help is appreciated.

progressDialog.setMessage("Please wait...");
progressDialog.setIndeterminate(true);
progressDialog.setCancelable(true);
progressDialog.show();
browseCategories();

protected void browseCategories() {
        Log.i(MY_DEBUG_TAG, "Bow!");
        Intent c = new Intent(this, CategoryListActivity.class);
    c.putExtra("user", u);
    startActivity(c);
}
+3
source share
2 answers

Using the progress dialogue in action immediately before launching another makes no sense.

The activity is for the most part oriented towards the user interface, and at the first launch a new one is “superimposed” over the first.

CategoryListActivity , (, ), , , . AsyncTask , , - .

+2

XMl :

   <ProgressBar 
        android:layout_marginTop="60dip"
        android:layout_gravity="center_horizontal"  
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/prgressbar"
        android:visibility="invisible"
      />

Onclick :

ProgressBar prgressbar;
prgressbar=(ProgressBar)findViewById(R.id.prgressbar);

prgressbar.setVisibility(LinearLayout.VISIBLE); // this of visible the progress bar 

prgressbar.setVisibility(LinearLayout.INVISIBLE); // this is for invisible 
0

Source: https://habr.com/ru/post/1779950/


All Articles