Friday, April 29, 2011

[android-developers] Re: How can I handle Exception message internationalization

Base your response on the class of the message
(e.getClass().getName(), or e instanceof SomeClass).

On Apr 26, 2:56 pm, Guilherme Matsumoto <>
> Hi Everyone,
> Here is an example of my problem:
> try {
>     // code that throws an exception} catch (Exception e) {
>     Toast.makeText(getApplicationContext(), e.getLocalizedMessage(),
> Toast.LENGTH_LONG).show();
> }
> I'd like it to show a message in other language in a beautiful way
> something like just overwriting the exception's internationalization
> string entry. Some thing like:
> <string name="exception_message_id">custom message</string>
> or
> <string name="@id/[package:][ExceptionClassName:]message_id">custom
> message</string>
> Is there any way of doing this or some other thing without using
> Exception.getMessage() string comparison?
> thks.

You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

No comments:

Post a Comment