Adding a Toast or Dailog in Exception Handling class
<pre><code>package com.greenway.primemobile.common;

import java.io.PrintWriter;
import java.io.StringWriter;

import com.greenway.primemobile.login.LoginActivity;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.widget.Toast;

public class ExceptionHandler implements java.lang.Thread.UncaughtExceptionHandler
{
    private final Context myContext;

    public ExceptionHandler(Context context) {
        myContext = context;
    }

    public void uncaughtException(Thread thread, Throwable exception) {             

        StringWriter stackTrace = new StringWriter();
        exception.printStackTrace(new PrintWriter(stackTrace));
        System.err.println(stackTrace);

        Intent intent = new Intent(myContext, ClassName.class);
        myContext.startActivity(intent);
        System.exit(0);

    }
}
</code></pre>

<p>The above class get's called when force-close happens, but how can i show a <code>dialog or toast</code> message to user that the application has crashed. Since its run on a different thread, i am not sure about how to add one.</p>
