IIRC, "Network unreachable" is a NoRouteToHostException.
If that's the case, you can have a separate catch block for that.
-- Kostya
29.04.2011 18:36, Guilherme Matsumoto пишет:
On Apr 28, 12:39 pm, TreKing<[email protected]> 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?
--
Kostya Vasilyev -- http://kmansoft.wordpress.com
--
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