android loading circle (spinner) between two activity -


i have main activity has simple buttons , listeners associated them. each button opens new activity (intent). while opening activity, takes time load causes ui freeze.i want avoid adding loading circle (spinner) in between. i've searched many posts still couldnt find anything.

thanks!

as loading circle mean image

that progress bar. may create programmatically or using widget in xml.

to implement 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 progress dialog asked in comments, can 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 next activity, should dismiss() progress bar.

  ndialog.dismiss(); 

Comments