On button click I am calling openChannel function
public void openChannel(View view)
{
progress.setProgress(10);
Toast.makeText(getBaseContext(), "Loading Please Wait",
Toast.LENGTH_SHORT).show();
loadNews("http://ift.tt/15e7jvb");
progress.setProgress(100);
}
public loadNews(String url)
{
obj = new HandleXML(url);
obj.fetchXML();
progress.setProgress(50);
while(obj.parsingComplete);
progress.setProgress(70);
loadViews();
progress.setProgress(90);
}
fetchXML is a thread which downloads xml and sets variables. Though it takes 2-5 seconds to load new view I can see progressbar jump from 0 to 100 directly.
Also Toast in openchannel ... it loads only after new view is loaded i.e. after loadView ... which breaks the purpose for what it was written.
Why it get delayed ? Any help aprreciated.
No comments:
Post a Comment