title: What to return for an Async Task
body: <p>I have two functions that access the internet on the APP start. I've tried to use <a href="https://stackoverflow.com/questions/1979524/android-splashscreen/1982002#comment11685166_1982002">this</a> post as a reference in order to have the popup dialog while my content loads. </p>
  
  <p>The two functions I would use are:</p>
  
  <pre><code>getImage(); //Gets an image from the internet for an imageview
  getJson();  //Where the app goes an parses a JSON object for a lazy load listview.
  </code></pre>
  
  <p>The problem I'm encountering with the post I referenced above is that I try to make the task return null but it causes the app to crash when I do this. So I have this:</p>
  
  <pre><code>private class DownloadTask extends AsyncTask&lt;String, Void, Object&gt; {
  protected Object doInBackground(String... args) {
      Log.i("MyApp", "Background thread starting");
  
      try {
          ImageView i = (ImageView) findViewById(R.id.currdoodlepic);
          Bitmap bitmap = BitmapFactory
                  .decodeStream((InputStream) new URL(imageURL)
                          .getContent());
          i.setImageBitmap(bitmap);
      } catch (MalformedURLException e) {
          e.printStackTrace();
      } catch (IOException e) {
          e.printStackTrace();
      }
      getJson("all");
  
      return "replace this with your data object";
  }  
  </code></pre>
  
  <p>I'm not sure what to return.</p>