Hi,

Could you tell us what Exception gets thrown....is it a subclass of
IOException or UnknowHostException?

Thanks,
Megha

On Tue, Apr 15, 2008 at 8:58 AM, E.D.I <[EMAIL PROTECTED]> wrote:

>
> i try to catch an exeption in a thread but although it does throws the
> exeption the catch i planted did not cought it, why is that?
>
> i wonder maby there is another layer od android that handles this
> exeption that i'm not awere of
>
> as u see in the example below the server is not working intentionly
> and thats why the exception is thrown in the socket.open() line
> cos the server that it is trying to connect to does not currently run,
> but the catcher does not catch it  and somehow it continue
> working ...
> by the way just for the record when the server is running there are no
> problems....
>
> private void SendLocation()
> {
>        String msg;
>        UTFSocketSender socket = new UTFSocketSender();
>        Location location;
>        try
>        {
>                location =
>
> ((LocationManager)getSystemService(Context.LOCATION_SERVICE)).getCurrentLocation("gps");
>                if(location!=null)
>                {
>                        msg = "<Latitude:" + location.getLatitude() + ">"+
>                                          "<Longitude:" +
> location.getLongitude() +
> ">";
>                        socket.open();
>                        socket.sendMessage(msg);
>                        socket.close();
>                        Log.d( LOG_TAG, "Location was Updated!!!" );
>                }
>        }
>        catch (UnknownHostException e)
>        {
>                Log.d( LOG_TAG, "Could Not Find The Host Server" );
>        }
>        catch (IOException e)
>        {
>                Log.d( LOG_TAG, "Could Not Open The Port For I/O" );
>        }
> }
> >
>

--~--~---------~--~----~------------~-------~--~----~
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]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to