ok.. totally weird. i'm trying make http request in android. works , can 'build' string using stringwriter code throws exception @ writer.tostring(). makes no difference if use stringbuilder or stringwriter.
try { httpresponse response = httpclient.execute(httppost); inputstream = response.getentity().getcontent(); stringbuilder writer = new stringbuilder(); //stringwriter writer = new stringwriter(); int ch; while(( ch = is.read()) != -1) { writer.append((char)ch); } string thestring = writer.tostring(); return thestring; } catch (exception e) { return e.getmessage(); }
any ideas?
the problem http thread attempting update ui thread httpresponse
in textview
or other such ui element calledfromwrongthreadexception
being raised.
using handler
or other such mechanism redirect ui thread ui update solve problem.
Comments
Post a Comment