Android Reading html in timer

edch

New Member
Its my code\[code\]String myUri = "http://....."; HttpClient httpClient = new DefaultHttpClient(); HttpGet get = new HttpGet(myUri); HttpResponse response = httpClient.execute(get); String bodyHtml = EntityUtils.toString(response.getEntity()); TextView textView1 = (TextView) findViewById(R.id.textView1); String s = bodyHtml;\[/code\]its work, but when i trying to run this code in timer\[code\] public void startThread(){ Integer y = 0; Integer z = 10000; long x = y.longValue(); long w = z.longValue(); Timer timer = new Timer(); timer.schedule(new TimerTask() { public void run() { //READ HTML CODE } }, x, w); } \[/code\]start in oncreate\[code\]startThread();\[/code\]I getting errors in this lines\[code\]HttpResponse response = httpClient.execute(get);String bodyHtml = EntityUtils.toString(response.getEntity());\[/code\]Unhandled exception type ClientProtocolException <- first lineUnhandled exception type IOException <- second linei was trying to add try but it crash :/
 
Top