Skip to main content
Bumped by Community user
deleted 589 characters in body
Source Link
rene
  • 2.8k
  • 2
  • 17
  • 35

I am brand new to the Stack Exchange API and Android (well, self taught in the last four months). I have been working on creating a school project focused around Android and JSON. My initial idea was to create an app for Stack Exchange but many have been there, done that and it turned out to be far too complicated for my current programming skills.

I finally have a simple working app to explain and demonstrate JSON parsing with Android for my project using the Stack Exchange API, but I just encountered an error I don't know how to handle.

I trimmed my project down drastically to create an app that shows the top ten users on Stack Overflow and displays their name, age and location. I know this app isn't useful for much, but it is just a demo of parsing the JSON in Android (and also gzip the JSON which I didn't know until I got outside help).

Using the documentation usage help I formed a query to find only the top ten users of Stack Overflow with their display_name, age and location listed. However 8 of the 10 entries do not contain the key-value pairs for age and/or location so now my app is not working and returns Could not fetch data from server. Eclipse LogCat showed me the org.json.JSONException error that there is No value for age.

Now, I know I have to research how to handle this exception but I was wondering if anyone had a easy to understand answer on how to handle this exception.

I am using

  • Windows 7
  • Eclipse Indigo Service Release 2
  • Android SDK 22.6.2 (hate it because I don't know how to use it as well as the SDK I started with)

running on a Galaxy Tab S3 with Android 4.1.2.

Thanks for any tips!

Update: I resolved this by putting if/else statements with the variables that were missing and setting the values to 0 or null if the key-value pair was missing.

This is the URL I used to return Stack Overflow's top twenty users sorted by reputation and listing only their name, age and location:

https://api.stackexchange.com/2.2/users?pagesize=20&order=desc&sort=reputation&site=stackoverflow&filter=!T6ovp2_VscH*jnbDel

I am brand new to the Stack Exchange API and Android (well, self taught in the last four months). I have been working on creating a school project focused around Android and JSON. My initial idea was to create an app for Stack Exchange but many have been there, done that and it turned out to be far too complicated for my current programming skills.

I finally have a simple working app to explain and demonstrate JSON parsing with Android for my project using the Stack Exchange API, but I just encountered an error I don't know how to handle.

I trimmed my project down drastically to create an app that shows the top ten users on Stack Overflow and displays their name, age and location. I know this app isn't useful for much, but it is just a demo of parsing the JSON in Android (and also gzip the JSON which I didn't know until I got outside help).

Using the documentation usage help I formed a query to find only the top ten users of Stack Overflow with their display_name, age and location listed. However 8 of the 10 entries do not contain the key-value pairs for age and/or location so now my app is not working and returns Could not fetch data from server. Eclipse LogCat showed me the org.json.JSONException error that there is No value for age.

Now, I know I have to research how to handle this exception but I was wondering if anyone had a easy to understand answer on how to handle this exception.

I am using

  • Windows 7
  • Eclipse Indigo Service Release 2
  • Android SDK 22.6.2 (hate it because I don't know how to use it as well as the SDK I started with)

running on a Galaxy Tab S3 with Android 4.1.2.

Thanks for any tips!

Update: I resolved this by putting if/else statements with the variables that were missing and setting the values to 0 or null if the key-value pair was missing.

This is the URL I used to return Stack Overflow's top twenty users sorted by reputation and listing only their name, age and location:

https://api.stackexchange.com/2.2/users?pagesize=20&order=desc&sort=reputation&site=stackoverflow&filter=!T6ovp2_VscH*jnbDel

I am brand new to the Stack Exchange API and Android (well, self taught in the last four months). I have been working on creating a school project focused around Android and JSON. My initial idea was to create an app for Stack Exchange but many have been there, done that and it turned out to be far too complicated for my current programming skills.

I finally have a simple working app to explain and demonstrate JSON parsing with Android for my project using the Stack Exchange API, but I just encountered an error I don't know how to handle.

I trimmed my project down drastically to create an app that shows the top ten users on Stack Overflow and displays their name, age and location. I know this app isn't useful for much, but it is just a demo of parsing the JSON in Android (and also gzip the JSON which I didn't know until I got outside help).

Using the documentation usage help I formed a query to find only the top ten users of Stack Overflow with their display_name, age and location listed. However 8 of the 10 entries do not contain the key-value pairs for age and/or location so now my app is not working and returns Could not fetch data from server. Eclipse LogCat showed me the org.json.JSONException error that there is No value for age.

Now, I know I have to research how to handle this exception but I was wondering if anyone had a easy to understand answer on how to handle this exception.

I am using

  • Windows 7
  • Eclipse Indigo Service Release 2
  • Android SDK 22.6.2 (hate it because I don't know how to use it as well as the SDK I started with)

running on a Galaxy Tab S3 with Android 4.1.2.

Brand new to Stack Exchange API Java exception when user age or location is unspecified in returned JSON

I am brand new to the Stack Exchange API and Android (well, self taught in the last four months). I have been working on creating a school project focused around Android and JSON. My initial idea was to create an app for Stack Exchange but many have been there, done that and it turned out to be far too complicated for my current programming skills.

I finally have a simple working app to explain and demonstrate JSON parsing with Android for my project using the Stack Exchange API, but I just encountered an error I don't know how to handle.

I trimmed my project down drastically to create basically this: Anan app that shows the Top Ten Userstop ten users on Stack Overflow and displays their name, age and location. I know this app isn't useful for much, but it is just a demo of parsing the JSON in Android (and also gzip the JSON which I didn't know until I got outside help).

Using the Stack Apps Usage/Try Itdocumentation usage help I formed a query/filter to find only the top ten users of Stack Overflow with their display_namedisplay_name, ageage and locationlocation listed. However 8 of the 10 entries do not contain the key/-value pairs for age and/or location so now my app is not working and returns 'Could not fetch data from server'Could not fetch data from server. Eclipse LogCat showed me the org.json.JSONExceptionorg.json.JSONException error that there is No value for ageNo value for age.

Now, I know I have to research how to handle this exception but I was wondering if anyone hashad a easy to understand answer on how to handle this exception?.

I am using Windows 7 Eclipse Indigo Service Release 2 Android SDK 22.6.2 (hate it b/c I don't know how to use it as well as the SDK I started with)

  • Windows 7
  • Eclipse Indigo Service Release 2
  • Android SDK 22.6.2 (hate it because I don't know how to use it as well as the SDK I started with)

Runningrunning on: Galaxy a Galaxy Tab S3 with Android 4.1.2.

Thanks for any tips!

Update:Update: I resolved this by putting if/else statements with the variables that were missing and setting the values to 0 or null if the key/-value pair was missing.

This is the URL I used to return Stack Overflow's top twentytwenty users sorted by reputation and listing only their name, age and location:   

https://api.stackexchange.com/2.2/users?pagesize=20&order=desc&sort=reputation&site=stackoverflow&filter=!T6ovp2_VscH*jnbDelhttps://api.stackexchange.com/2.2/users?pagesize=20&order=desc&sort=reputation&site=stackoverflow&filter=!T6ovp2_VscH*jnbDel

Brand new to Stack Exchange API

I am brand new to Stack Exchange API and Android (well, self taught in the last four months). I have been working on creating a school project focused around Android and JSON. My initial idea was to create an app for Stack Exchange but many have been there, done that and it turned out to be far too complicated for my current programming skills.

I finally have a simple working app to explain and demonstrate JSON parsing with Android for my project using the Stack Exchange API but I just encountered an error I don't know how to handle.

I trimmed my project down drastically to create basically this: An app that shows the Top Ten Users on Stack Overflow and displays their name, age and location. I know this app isn't useful for much, but it is just a demo of parsing the JSON in Android (and also gzip the JSON which I didn't know until I got outside help).

Using the Stack Apps Usage/Try It I formed a query/filter to find only the top ten users of Stack Overflow with their display_name, age and location listed. However 8 of the 10 entries do not contain the key/value pairs for age and/or location so now my app is not working and returns 'Could not fetch data from server' Eclipse LogCat showed me the org.json.JSONException error that there is No value for age.

Now, I know I have to research how to handle this exception but wondering if anyone has a easy to understand answer on how to handle this exception?

I am using Windows 7 Eclipse Indigo Service Release 2 Android SDK 22.6.2 (hate it b/c I don't know how to use it as well as the SDK I started with)

Running on: Galaxy Tab S3 Android 4.1.2

Thanks for any tips!

Update: I resolved this by putting if/else statements with the variables that were missing and setting the values to 0 or null if the key/value pair was missing.

This is the URL I used to return Stack Overflow's top twenty users sorted by reputation and listing only their name, age and location:  https://api.stackexchange.com/2.2/users?pagesize=20&order=desc&sort=reputation&site=stackoverflow&filter=!T6ovp2_VscH*jnbDel

Java exception when user age or location is unspecified in returned JSON

I am brand new to the Stack Exchange API and Android (well, self taught in the last four months). I have been working on creating a school project focused around Android and JSON. My initial idea was to create an app for Stack Exchange but many have been there, done that and it turned out to be far too complicated for my current programming skills.

I finally have a simple working app to explain and demonstrate JSON parsing with Android for my project using the Stack Exchange API, but I just encountered an error I don't know how to handle.

I trimmed my project down drastically to create an app that shows the top ten users on Stack Overflow and displays their name, age and location. I know this app isn't useful for much, but it is just a demo of parsing the JSON in Android (and also gzip the JSON which I didn't know until I got outside help).

Using the documentation usage help I formed a query to find only the top ten users of Stack Overflow with their display_name, age and location listed. However 8 of the 10 entries do not contain the key-value pairs for age and/or location so now my app is not working and returns Could not fetch data from server. Eclipse LogCat showed me the org.json.JSONException error that there is No value for age.

Now, I know I have to research how to handle this exception but I was wondering if anyone had a easy to understand answer on how to handle this exception.

I am using

  • Windows 7
  • Eclipse Indigo Service Release 2
  • Android SDK 22.6.2 (hate it because I don't know how to use it as well as the SDK I started with)

running on a Galaxy Tab S3 with Android 4.1.2.

Thanks for any tips!

Update: I resolved this by putting if/else statements with the variables that were missing and setting the values to 0 or null if the key-value pair was missing.

This is the URL I used to return Stack Overflow's top twenty users sorted by reputation and listing only their name, age and location: 

https://api.stackexchange.com/2.2/users?pagesize=20&order=desc&sort=reputation&site=stackoverflow&filter=!T6ovp2_VscH*jnbDel

added 429 characters in body
Source Link

I am brand new to Stack Exchange API and Android (well, self taught in the last four months). I have been working on creating a school project focused around Android and JSON. My initial idea was to create an app for Stack Exchange but many have been there, done that and it turned out to be far too complicated for my current programming skills.

I finally have a simple working app to explain and demonstrate JSON parsing with Android for my project using the Stack Exchange API but I just encountered an error I don't know how to handle.

I trimmed my project down drastically to create basically this: An app that shows the Top Ten Users on Stack Overflow and displays their name, age and location. I know this app isn't useful for much, but it is just a demo of parsing the JSON in Android (and also gzip the JSON which I didn't know until I got outside help).

Using the Stack Apps Usage/Try It I formed a query/filter to find only the top ten users of Stack Overflow with their display_name, age and location listed. However 8 of the 10 entries do not contain the key/value pairs for age and/or location so now my app is not working and returns 'Could not fetch data from server' Eclipse LogCat showed me the org.json.JSONException error that there is No value for age.

Now, I know I have to research how to handle this exception but wondering if anyone has a easy to understand answer on how to handle this exception?

I am using Windows 7 Eclipse Indigo Service Release 2 Android SDK 22.6.2 (hate it b/c I don't know how to use it as well as the SDK I started with)

Running on: Galaxy Tab S3 Android 4.1.2

Thanks for any tips!

Update: I resolved this by putting if/else statements with the variables that were missing and setting the values to 0 or null if the key/value pair was missing.

This is the URL I used to return Stack Overflow's top twenty users sorted by reputation and listing only their name, age and location: https://api.stackexchange.com/2.2/users?pagesize=20&order=desc&sort=reputation&site=stackoverflow&filter=!T6ovp2_VscH*jnbDel

I am brand new to Stack Exchange API and Android (well, self taught in the last four months). I have been working on creating a school project focused around Android and JSON. My initial idea was to create an app for Stack Exchange but many have been there, done that and it turned out to be far too complicated for my current programming skills.

I finally have a simple working app to explain and demonstrate JSON parsing with Android for my project using the Stack Exchange API but I just encountered an error I don't know how to handle.

I trimmed my project down drastically to create basically this: An app that shows the Top Ten Users on Stack Overflow and displays their name, age and location. I know this app isn't useful for much, but it is just a demo of parsing the JSON in Android (and also gzip the JSON which I didn't know until I got outside help).

Using the Stack Apps Usage/Try It I formed a query/filter to find only the top ten users of Stack Overflow with their display_name, age and location listed. However 8 of the 10 entries do not contain the key/value pairs for age and/or location so now my app is not working and returns 'Could not fetch data from server' Eclipse LogCat showed me the org.json.JSONException error that there is No value for age.

Now, I know I have to research how to handle this exception but wondering if anyone has a easy to understand answer on how to handle this exception?

I am using Windows 7 Eclipse Indigo Service Release 2 Android SDK 22.6.2 (hate it b/c I don't know how to use it as well as the SDK I started with)

Running on: Galaxy Tab S3 Android 4.1.2

Thanks for any tips!

I am brand new to Stack Exchange API and Android (well, self taught in the last four months). I have been working on creating a school project focused around Android and JSON. My initial idea was to create an app for Stack Exchange but many have been there, done that and it turned out to be far too complicated for my current programming skills.

I finally have a simple working app to explain and demonstrate JSON parsing with Android for my project using the Stack Exchange API but I just encountered an error I don't know how to handle.

I trimmed my project down drastically to create basically this: An app that shows the Top Ten Users on Stack Overflow and displays their name, age and location. I know this app isn't useful for much, but it is just a demo of parsing the JSON in Android (and also gzip the JSON which I didn't know until I got outside help).

Using the Stack Apps Usage/Try It I formed a query/filter to find only the top ten users of Stack Overflow with their display_name, age and location listed. However 8 of the 10 entries do not contain the key/value pairs for age and/or location so now my app is not working and returns 'Could not fetch data from server' Eclipse LogCat showed me the org.json.JSONException error that there is No value for age.

Now, I know I have to research how to handle this exception but wondering if anyone has a easy to understand answer on how to handle this exception?

I am using Windows 7 Eclipse Indigo Service Release 2 Android SDK 22.6.2 (hate it b/c I don't know how to use it as well as the SDK I started with)

Running on: Galaxy Tab S3 Android 4.1.2

Thanks for any tips!

Update: I resolved this by putting if/else statements with the variables that were missing and setting the values to 0 or null if the key/value pair was missing.

This is the URL I used to return Stack Overflow's top twenty users sorted by reputation and listing only their name, age and location: https://api.stackexchange.com/2.2/users?pagesize=20&order=desc&sort=reputation&site=stackoverflow&filter=!T6ovp2_VscH*jnbDel

Source Link
Loading