i have a thread that is connecting to a url to obtaining some data.
Sometimes the method httpConnection.connect(); taked too munch time to get
the response, and i want to limit the loading dialog of this connection
thread to 5 seg.
I tryed adding timeouts into the code, *but it doesn't work*!!
URL formattedUrl = new URL(url);
URLConnection connection = formattedUrl.openConnection();
connection.setConnectTimeout(5000);
connection.setReadTimeout(5000);
HttpURLConnection httpConnection = (HttpURLConnection) connection;
httpConnection.setAllowUserInteraction(false);
httpConnection.setInstanceFollowRedirects(true);
httpConnection.setRequestMethod("GET");
httpConnection.setConnectTimeout(5000);
httpConnection.setReadTimeout(5000);
httpConnection.connect();
So, i must stop the connect method and the thread when 5000 seconds have
passed or when the used has pressed the back key on the phone.
How can this be achieved? i can't find info about doing this work in
android with a url connection thread.
thanks
--
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