title: show listview in synctask class android
body: <p>i'm a beginner. I want to show a listview in asyncTask so I have this code but I don't know how this wrong in the line below:</p>
  
  <pre><code>ListAdapter adapter =new SimpleAdapter(this, result,android.R.layout.simple_list_item_1, new String[] {"planet"}, new int[] {android.R.id.text1});
  </code></pre>
  
  <p>can you have me fix it?</p>
  
  <p>My code:</p>
  
  <pre><code> public class MainActivity extends Activity {
      List&lt;Map&lt;String, String&gt;&gt; planetsList;
      ListAdapter simpleAdpt;
      ListView lv;
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          lv=(ListView) this.findViewById(R.id.listView1);
          planetsList = new ArrayList&lt;Map&lt;String,String&gt;&gt;();
  
          initList();
          simpleAdpt = new SimpleAdapter(this, planetsList, android.R.layout.simple_list_item_1, new String[] {"planet"}, new int[] {android.R.id.text1});
  
          lv.setAdapter(simpleAdpt);
      }
  
  
       private void initList() {
              // We populate the planets into planetslist
  
              planetsList.add(createPlanet("planet", "Mercury"));
              planetsList.add(createPlanet("planet", "Venus"));
              planetsList.add(createPlanet("planet", "Mars"));
              planetsList.add(createPlanet("planet", "Jupiter"));
              planetsList.add(createPlanet("planet", "Saturn"));
              planetsList.add(createPlanet("planet", "Uranus"));
              planetsList.add(createPlanet("planet", "Neptune"));
  
      }
  
       private HashMap&lt;String, String&gt; createPlanet(String key, String name) {
              HashMap&lt;String, String&gt; planet = new HashMap&lt;String, String&gt;();
              planet.put(key, name);
  
              return planet;
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.main, menu);
          return true;
      }
  
  }
  </code></pre>