Android boot circle (spinner) between two activities

I have a main action in which there are simple buttons and listeners associated with them. Each button opens a new action (intention). However, when opening the download activity, it takes some time, which causes the user interface to freeze. I want to avoid this by simply adding a download circle (counter) there. I searched for a lot of posts but still didn't find anything.

Thanks!

as a boot circle i mean it image

+7
android android spinner
source share
2 answers

This is the Progress Bar . You can create this programmatically or using a widget in XML.

For implementation in XML:

 <ProgressBar android:id="@+id/progress_loader" style="?android:attr/progressBarStyle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:visibility="visible" /> 

To implement in Java (using the Progress Dialog , as you requested in the comments, but you can also do it with the Progress Bar )

  ProgressDialog nDialog; nDialog = new ProgressDialog(Login.this); nDialog.setMessage("Loading.."); nDialog.setTitle("Get Data"); nDialog.setIndeterminate(false); nDialog.setCancelable(true); nDialog.show(); 

Before reaching the next action, you must dismiss() progress bar.

  nDialog.dismiss(); 
+10
source share

Just use below code in second step

 <ProgressBar android:id="@+id/progress_loader" style="?android:attr/progressBarStyle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:visibility="visible" /> 

make visibility lost when you finish initialization

+1
source share

All Articles