java - How to put method into the AsyncTask -
hello have little problem. how , should set method in asynctask or maybe better, how should in asynctask.
here's code
public void licz() { wyniki.settext(""); n = integer.parseint(liczban.gettext().tostring()); tablica = new string [90]; int i=0; for(licz1=99;licz1>=10;licz1--) { for(licz2=10;licz2<=licz1;licz2++) { if(n==licz1/licz2 && licz1%licz2==0) { string nap1 = integer.tostring(licz1); string nap2 = integer.tostring(licz2); napis = (nap1+ " " + nap2 +"\n"); // moj string lista.add(napis); tablica[i]=napis; i++; wyniki.settext(""); } } string liststring = ""; (string s : tablica) { liststring += s; } liststring=liststring.replaceall("null", ""); wyniki.settext(liststring); } } declare asynctask<void, string, void>. put code within doinbackground(). replace occurences of wyniki.settext(whatever); publishprogress(whatever); in onprogressupdate(), utilize wyniki.settext(progress[0]);
the lastly 2 steps important, cannot alter ui views background thread.
java android methods android-asynctask
No comments:
Post a Comment