I have the following in my Activity that I use to download a users films in their LoveFilm queue, but the ProgressDialog never appears.
public class MyListActivity extends Activity {
SharedPreferences prefs;
ProgressDialog m_progressDialog;
Thread listThread;
User user;
private Runnable threadProc_initializeQueue = new Runnable() {
public void run() {
user.fetchQueues();
Queue defaultQueue = user.getDefaultQueue();
defaultQueue.fetchTitles();
m_progressDialog.dismiss();
}
};
/* (non-Javadoc)
* @see android.app.Activity#onCreate(android.os.Bundle)
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
prefs = getSharedPreferences(getString(R.string.app_name), MODE_PRIVATE);
// Authenticate the user if needs be.
if(!prefs.getBoolean("isAuthenticated", false)) {
Intent i = new Intent(this, OAuthActivity.class);
startActivity(i);
finish();
} else {
// Get the users default list.
LoveDroid app = (LoveDroid) getApplication();
user = new User(app);
m_progressDialog = ProgressDialog.show(MyListActivity.this, "Please Wait", "Loading", true);
listThread = new Thread(null, threadProc_initializeQueue);
listThread.run();
}
}
I've seen others with this problem, and they all basically get around to recommending a line that looks like mine
m_progressDialog = ProgressDialog.show(MyListActivity.this, "Please Wait", "Loading", true);
The rest of the code works, the users films are downloaded via the thread, but the dialog never shows up, it takes a few seconds too, it's not like the dialog is being dismissed before it's had time to appear.