onPostExecute is getting null result on Android 4.2.2 -
my code working on upper version of android. whenever trying run program on jelly bean 4.2.2 not working. minimum sdk version is: 14 , target sdk version is: 22
my code is:
private class authasync extends asynctask<string, integer, string> { @override protected void onpreexecute() { } @override protected string doinbackground(string... params) { httpget request = new httpget(params[0] + params[1]); responsehandler<string> responsehandler = new basicresponsehandler(); string responsetxt = null; httpclient client = paywellservices.gettrustedhttpclient(); try { responsetxt = client.execute(request, responsehandler); } catch (clientprotocolexception ex) { ex.printstacktrace(); } catch (ioexception ex) { ex.printstacktrace(); } return responsetxt; } @override protected void onpostexecute(string result) { super.onpostexecute(result); try { log.e("log","try"); log.e("result",result); if (result != null && result.contains("@")) { string splitedarray[] = result.split("@@@"); } } catch (arrayindexoutofboundsexception e) { log.e("log","catch"); e.printstacktrace(); } } }
technically, the result return doinbackground passed onpostexecute.
result input parameter on onpostexecute() same string returned in doinbackground() responsetxt
at first glance, im thinking of block of code in particular :
try { responsetxt = client.execute(request, responsehandler); } catch (clientprotocolexception ex) { ex.printstacktrace(); } catch (ioexception ex) { ex.printstacktrace(); } return responsetxt;
as debug, try check value (or print console) of responsetxt before returning it.
clue result of paywell client returning null when invoking method in :
responsetxt = client.execute(request, responsehandler);
Comments
Post a Comment