You're absolutely correct TreKing.  I forgot to include the key piece of 
information for the Toast message.  You have to make use of the Looper 
class from Android.

For example, here is the code from the "displayErrorMessageToast()" method 
I previously mentioned...

    private void displayErrorMessageToast() {
        new Thread() {
            @Override
            public void run() {
                Looper.prepare();
                
                String errorMsg = "Some string to display"; //ideally this 
string would be in your Resources
                Toast.makeText(mContext, errorMsg, Toast.LENGTH_LONG).show();
                
                Looper.loop();
            }
        }.start();
    }


So, what happens is the UI Thread is sleeping (and therefore, *NOT* getting 
killed) while this thread is kept alive by using the Looper and displaying 
the Toast message.

On Thursday, March 22, 2012 10:56:41 PM UTC-4, TreKing wrote:
>
> On Thu, Mar 22, 2012 at 8:59 PM, mcterry wrote:
>
>> When you override the uncaughtException() method, add in a Thread.sleep() 
>> in order to keep your Activity from getting closed immediately.
>
>
> That would cause the main thread to block, preventing the error message 
> from being displayed, and causing an ANR on top of the force close.
>
>
> ------------------------------​------------------------------​------------------------------​-------
> TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago 
> transit tracking app for Android-powered devices
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to