title: How to update listview after calling Asynctask to call webservice
body: <p>I am calling a <code>webservice</code> through <code>asynctask</code>, to call the <code>webservice</code> i am calling one method named <code>makeRequest()</code> in <code>doInBackground()</code>, I am getting the response in another methods <code>success()</code>, In success method i am updating the <code>listview</code> </p>
  
  <p>But i am getting error like </p>
  
  <pre><code>android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views."
  </code></pre>
  
  <p>Here Im adding my code.Im calling <code>synctask</code> from activity</p>
  
  <pre><code>new MyTask(this,urlAsString,sp).execute(); 
  </code></pre>
  
  <p>here is the Asynctask class</p>
  
  <pre><code>class MyTask extends AsyncTask&lt;Void, Void, Void&gt; {
          ProgressDialog progress;
  
          String url;
          SharedPreferences sp;
          HomepageH2desk c;
            public MyTask(HomepageH2desk context,String url,SharedPreferences sp) {
              this.c = context;
              this.url = url;
              this.sp = sp;
              progress = new ProgressDialog(this.c);
              progress.setMessage("Loading...");
            }
  
            public void onPreExecute() {
              progress.show();
            }
  
            public Void doInBackground(Void... unused) {
               c.getTickets(url,sp);
              return null;
              //progress.setMessage("Loading...");
            }
  
            public void onPostExecute(Void unused) {
              progress.dismiss();
            }
          }
  </code></pre>
  
  <p>Here im getting <code>webservice</code> response</p>
  
  <pre><code> public void success(Object result) {
  
       list = (ArrayList&lt;Map&lt;String, String&gt;&gt;) result;
  
      this.adapter.setList(list);
              this.adapter.notifyDataSetChanged();
  }
  </code></pre>
  
  <p><code>listview</code> is not getting updated and showing error </p>
  
  <pre><code>android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
  </code></pre>
  
  <p>Help me to solve this problem...</p>