Friday, April 29, 2011

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

On Apr 28, 12:39 pm, TreKing <treking...@gmail.com> wrote:
> Then don't show the exception message. What will the average do with that?
> If you know what the exception is and know what it means for you app, then
> show them a dedicated message for that error. IOW, instead of showing
> "SocketException: Unknown Host" or something, show "Could not connect to
> server." or something, which you localize with your own set of strings.

Thanks for the answer but the problem is that I have 2 different
messages for the same exception I'll show the part of the code.

try{
...
} catch (SocketException e) {
throw new CustomException(e.getMessage());
// e.getMessage() can return "Network unreachable" or can return
"The operation timed out" both from SocketException.
// and for now CustomException translate it comparing string
literals.
}

What I want to do is show these two messages but translated and I
don't want to do it comparing string literal.
Any ideas?

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

No comments:

Post a Comment