About the author
The following code demonstrates how to show a progress dialog while starting up an Android activity. The progress dialog is shown near the end of the creation of the activity. There, a thread is created and started up.
When the thread has finished completion, it queues code to dismiss the progress dialog into the UI thread.
public class listApks extends Activity { ProgressDialog mprogressDialog; private void someTasks() { // run some private code here } private class someTasksThread extends Thread { Handler mHandler; someTasksThread(Handler h) { mHandler = h; } public void run() { // run some stuff here mHandler.post(new Runnable() { @Override public void run() { mprogressDialog.dismiss(); // post results here into the user interface } }); } } /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main);
mprogressDialog = ProgressDialog.show(this, "", "Loading. Please wait...", true); Thread thread = new someTasksThread(new Handler()); thread.start(); }}
Continued discussion of undocumented Delphi 8 Property Access Specifiers, and other ways of adding and removing delegates / events handlers, including clearing the list of all the delegates / event handlers.