title: Android Jackson JSON Parser null value
body: <p>I am using the Jackson JSON parser as I heard it was a lot more efficient than the default Android parser. I learned how to use it off this tutorial here</p>
  
  <p><a href="http://www.mkyong.com/java/jackson-streaming-api-to-read-and-write-json/" rel="nofollow">http://www.mkyong.com/java/jackson-streaming-api-to-read-and-write-json/</a></p>
  
  <p>which is great tutorial if anyone wants to learn how to use Jackson json parser.</p>
  
  <p>However, I am having an issue in that I can parse data fine in Java from a URL, however when I use Jackson with Android, I get null values or the screen just shows up black for some reason.</p>
  
  <p>In order to retrieve the data from the website I am using this code from here</p>
  
  <p><a href="http://www.javacodegeeks.com/2011/01/android-json-parsing-gson-tutorial.html" rel="nofollow">http://www.javacodegeeks.com/2011/01/android-json-parsing-gson-tutorial.html</a></p>
  
  <pre><code>  private InputStream retrieveStream(String url) {
  
      DefaultHttpClient client = new DefaultHttpClient(); 
  
      HttpGet getRequest = new HttpGet(url);
  
      try {
  
         HttpResponse getResponse = client.execute(getRequest);
         final int statusCode = getResponse.getStatusLine().getStatusCode();
  
         if (statusCode != HttpStatus.SC_OK) { 
            Log.w(getClass().getSimpleName(), 
                "Error " + statusCode + " for URL " + url); 
            return null;
         }
  
         HttpEntity getResponseEntity = getResponse.getEntity();
         return getResponseEntity.getContent();
  
      } 
      catch (IOException e) {
         getRequest.abort();
         Log.w(getClass().getSimpleName(), "Error for URL " + url, e);
      }
  
      return null;
  
   }
  </code></pre>
  
  <p>Then in my parse data method</p>
  
  <pre><code>        InputStream source = retrieveStream(url);
  
      try {
  
          JsonFactory jfactory = new JsonFactory();
  
  
          JsonParser jParser = jfactory.createJsonParser(source);
  </code></pre>
  
  <p>Then I parse data as was shown in the tutorial I linked above</p>
  
  <pre><code>    while (jParser.nextToken() != JsonToken.END_OBJECT) {
  
              String fieldname = jParser.getCurrentName();
              if ("Name".equals(fieldname)) {
                  jParser.nextToken();
                  this.setName(jParser.getText());
              }
              if ("Number".equals(fieldname)) {
                  jParser.nextToken();
                  this.setNumber(jParser.getText());
              }
          }
  </code></pre>
  
  <p>The url I am using is a dummy site set up which just has a JSON file on it which I am using to practice Jackson JSON parsing.</p>
  
  <p>Now I know my parse data code is fine, as I in normal Java class, I can parse the data from the website using the code I created, and it works fine.</p>
  
  <p>However if I try to use the code in Android with the code I have just shown, I just get a black screen for some odd reason. I have internet permissions enabled in manifest</p>
  
  <p>Is there something wrong with the http code I have used? If so could someone show me how it should be done? And also why I am getting a black screen, I don't understand why it would show that.</p>
  
  <p>Thanks in advance</p>