android - Showing a progressbar from within a fragemnet -


i have working app contains fragment declared follows:

public class searchablelistfragment extends fragment implements tablistener 

at 1 point during work of fragment, execute rather slow loop. imagine like:

for(int = 0;i < large_number;i++) {     // complex maths } 

but loop takes rather long time , i'd have progress bar appear during loop. have seen variety of examples of adding dialogs, seem fail because 1 part or appears not apply fragments.... or not applicable because assume 1 thing or not apply in case. how can wrap loop in code display progress bar (either linear bar or swirling circle - whatever's easiest).

edit: fragment deployed within sherlockfragmentactivity. fragments being implemented via android.support.v4.app.*

you might want take @ question: addview not visible in custom framelayout clickable

especially "solution" ( http://pastebin.com/2xjncdls ), viewgroup switches between progressbar , contentview(s), , usable in layout-xml, helpful me in various occasions. call showprogressbar() before , shownext() after you've loaded content/made computations.


Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

c++ - Correct method for redrawing a layered window -

java.util.scanner - How to read and add only numbers to array from a text file -