I am using a progress bar in android, so that till my data is loaded, user is getting a proper feedback of what is going on. the code for the bar is below:
final ProgressDialog myProgressDialog;
myProgressDialog = ProgressDialog.show(ListingPage.this,"Please Wait", "Loading Date", true);
new Thread() {
public void run() {
try{
setSelected();
sleep(5000);
} catch (Exception e) { }
myProgressDialog.dismiss();
}
}.start();
The setSelected() method is inserting data into an array list, and then creating an array adapter and then using a list view to show those items.
so when I put the setSelected() method in progress bar, it shows the loading circle, but once loading is done. Nothing is displayed in listview. But if I take out progress bar code (thread and run method), and simply call setSelected() method, the listview successfully declares the data. so far it concludes that the progress bar code is doing some thing...so wanted to know am I missing something to add in or take out from the code. I need to the show progress bar as I am reading data from online source and it takes time , which may make user uncomfortable.