I´m trying to get the remote xml content on my Android Application using the code:
URL aUrl = new URL(url);
HttpURLConnection conn = (HttpURLConnection)aUrl.openConnection();
conn.setRequestMethod("GET");
conn.setDoOutput(true);
conn.setReadTimeout(15 * 1000); // timeout for reading the google maps data: 15 secs
conn.connect();...
When I try to connect() I’m getting the exception:
NetworkOnMainThreadException (id=830019595736)
Any idea?
Do the same inside a thread:
of course
AsyncTaskis also a way to go