Using java Syntax Highlighting
- setContentView(R.layout.main);
- PDialog = ProgressDialog.show(HHDConvert.this,
- "", "Please wait for screen to load", true, true);
- // I dismiss() it immediately until I'm ready to show() it
- PDialog.dismiss();
- // ...
- // Buttons and listeners created here
- ...
- final ImageButton someButton10 = (ImageButton) findViewById(R.id.calorieButton10);
- someButton10.setOnClickListener(new View.OnClickListener() {
- public void onClick(View v) {
- // I found that the only way for me to show() the ProgressDialog
- // was to create this Thread.
- // PDialog.show(); did not work on it's own
- Thread t = new Thread(new Runnable() {
- public void run() {
- Looper.prepare();
- PDialog.show();
- Looper.loop();
- }
- }); t.start();
- // This method immediately calls: setContentView(R.layout.convxml);
- // and creates many buttons in a LinerLayout and can take two seconds.
- new_layout_of_Buttons(calorienum, caloriestr, caloriedouble);
- // It all works very well until I try to dismiss() PDialog
- PDialog.dismiss();
- } // End of onClick
- }); // End of setOnClickListener
Parsed in 0.033 seconds, using GeSHi 1.0.8.4
I think it has something to do with creating the ProgressDialog in one setContextView(main) and then trying to dismiss() it in the second setContextView(convxml), but I'm stumped.
Thanks in advance.


