Note that there are some explanatory texts on larger screens.

plurals
  1. POVisibility of ProgressBar
    text
    copied!<p>I need to process some data when the user click the button in one activity, so the screen looks like the app stops for 2-3 seconds. It isn't a lot but I want to give the user information that everything is ok and IMO the best way will be the progressbar which is visible only when data are processed. </p> <p>I found the code of ProgressBar and it looks like this:</p> <pre><code> &lt;ProgressBar android:id="@+id/loadingdata_progress" style="?android:attr/progressBarStyle" android:layout_width="50dp" android:layout_height="50dp" android:layout_alignBottom="@+id/fin2_note" android:layout_centerHorizontal="true" android:indeterminate="true" android:visibility="invisible" /&gt; </code></pre> <p>and inserted it on the middle of my layout.</p> <p>And to try if the progressbar works, I put this code </p> <p><code>loadingimage= (ProgressBar) findViewById(R.id.loadingdata_progress); loadingimage.setVisibility(View.VISIBLE); </code></p> <p>into <code>onCreate</code> method and everything looks fine. Then I recreated the code to show this progressbar only if the data is processed. </p> <p>After click the user invoke this method </p> <pre><code> public void fin2_clickOnFinalization(View v) { loadingimage= (ProgressBar) findViewById(R.id.loadingdata_progress); loadingimage.setVisibility(View.VISIBLE); // code where data is processing loadingimage.setVisibility(View.INVISIBLE); } </code></pre> <p>and nothing appear on the screen. I don't know where is the mistake. If I found the progress bar by id, It's strange for me that I can control it in onCreate method but in onclick method it's out of my control. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload