title: Android - Get object from AsyncTask result
body: <p>I want to create 10 Employee objects in an AsyncTask and return the result back to the MainActivity class to print it on a ListView with the 3 attributes of an Employee object.</p>
  
  <p>This is what i have so far, but it just crashes after running</p>
  
  <p>Menu class</p>
  
  <pre><code>public class Menu 
  {
      public Employee person;
  
      public void onButtonClick(View v) {
          new setEMPInfo() {
              protected void onPostExecute(Employee person)
              {
                  doSomething(person);
              }   
          }.execute();
      }
      public void doSomething(Employee person) {
         //use person object to print on TextView 
      }
  }
  </code></pre>
  
  <p>setEMPInfo class</p>
  
  <pre><code>public class setEMPInfo extends AsyncTask&lt;Void, Void, Employee&gt;
  {
      Public Employee person;
  
      protected Bus doInBackground(String... params) {
          String id = "100A";
          String Fname = "John";
          String Lname = "Smith";
  
          for (int i = 0; i &lt; 10; i++) {
              person = new Employee(id, Fname, Lname);
          }
      return person;
      }
  }
  </code></pre>