Monday 15 August 2011

android - Is there a cache is async task? My results aren't changing when they should -


I'm using async work in Android to get json from an online database so that it can be detected that the user The password and username are correct or not.

Every time I test on my phone, the JSSN string for "status" is not always and never, when I type the correct information.

But when I type the browser in my test with the same information in my phone, I get the right Jason result, it is always returning "no"

Async works :

  Public Class ReadLogInJSON AsyncTask and String, Zero, String & gt; {Reference C; Public Reedlog Ingestion (reference reference) {c = context; } @ Override protected string doInBackground (string ... arg0) {// TODO auto generated method stub returns Jasonfid (Arg 0 [0]); } Protected Zero PostExecute (string result) {// decode Jason Try Here {JSONObject json = New JSONObject (Results); String position = json.getString ("status"); Log D. ("First", position); If (status.equals ("no")) // // toast login fail log. ("Login-no", position); String message = "login failed"; Toast. Make Text (C, Message, Toast. LNNGHHORAT) Show (); } Else {// Get Username Log D. ("Login-yes", "correct"); // Get User ID // Set Preferences // Launch General Activity}} Catch (Exception E) {}} Public String ReaderZoneFeed (String URL) {StringBillilder StringBillilder = New StringBilder (); HTTP Client HTTP Client = New DefaultHttpClient (); HttpGet httpGet = New HttpGet (URL); Try {HttpResponse response = httpClient.execute (httpGet); Threaded Positions = Response .getStatusLine (); Int statusCode = statusLine.getStatusCode (); If (statusCode == 200) {HttpEntity entity = response.getEntity (); InputStream inputstream = entity.getContent (); BufferedReader Reader = New BufferedReader (New InputStreamReader (InputStream)); String line; While ((line = reader.readline ()) = faucet {stringBuilder.append (line); } Inputstream.close (); } Else {Log.d ("JSON", "Failed to download file"); }} Hold (exception e) {log d. ("ReadJSONFeed", E..T.O.Localized Message ()); } Return stringBuilder. Toasting (); }}    

Is there a cache async function?

No, it does not cache its results. You can see it by looking at the source code

No comments:

Post a Comment