Wednesday, March 9, 2011

Re: [android-developers] Parsing a JSON response

On Wed, Mar 9, 2011 at 11:01 PM, David Williams
<dwilliams@dtw-consulting.com> wrote:
> So, I can see that retInit is getting this return string, but is there an easy way of breaking down this JSON object so that I can check (for example) the value or errcode ?

Check out the org.json package in Android, such as JSONObject.

> Also, is there a way to check the return status of URLConnection conn = url.openConnection(); ? I'd use this to ensure I was able to get a good connection.

I would recommend using HttpClient and a BasicResponseHandler instead
of URL and URLConnection.

That being said, your URLConnection will really be an instance of
HttpUrlConnection, which has all the information you will need (e.g.,
getResponseCode()).

> Appreciate any help on this.  Again, I am coming from WebOS and Mojo had these kind of things pretty much built in.

So does Android.

That being said, perhaps PhoneGap will be a better environment for
you, to better leverage your WebOS background.

--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training Worldwide: http://commonsware.com/training

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate