title: Show ProgressDialog Android
body: <p>I have an EditText which takes a String from the user and a searchButton.
  When the searchButton is clicked, it will search through the XML file and display it in the ListView.</p>
  
  <p>I am able to take input from the user, search through the XML file and display the usersearched value in the ListView also.</p>
  
  <p>What I want is to display a <code>ProgressDialog</code> after the searchButton is clicked like "PLEASE WAIT...RETRIEVING DATA..." or something like that and dismiss it when the data is shown.</p>
  
  <pre><code>public class Tab1Activity extends ListActivity {
  private Button okButton;
  private Button searchButton;
  Toast toast;
  String xml;
  
  private TextView searchText;
  private String searchTextString;
  HashMap&lt;String, String&gt; o;
  ArrayList&lt;HashMap&lt;String, String&gt;&gt; mylist = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;();
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.tab1);
  
      searchButton = (Button) findViewById(R.id.search_button);
      searchButton.setOnClickListener(new View.OnClickListener() {
  
          public void onClick(View v) {
              // TODO Auto-generated method stub
              System.out.print("hello");
  
              searchText = (TextView) findViewById(R.id.search_text);
              searchTextString = searchText.getText().toString();
              readXml(searchTextString);
  
          }
      });
  
  }
  
  private void readXml(String searchTextString1) {
      ArrayList&lt;HashMap&lt;String, String&gt;&gt; mylist = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;();
  
      String xml = XMLfunctions.getXML();
              //Here XMLfunctions is class name which parse xml
      Document doc = XMLfunctions.XMLfromString(xml);
  
      int numResults = XMLfunctions.numResults(doc);
  
      if ((numResults &lt;= 0)) {
          Toast.makeText(Tab1Activity.this, "Testing xmlparser",
                  Toast.LENGTH_LONG).show();
          finish();
      }
  
      NodeList nodes = doc.getElementsByTagName("result");
  
      for (int i = 0; i &lt; nodes.getLength(); i++) {
          HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;();
  
          Element e = (Element) nodes.item(i);
          String nameMapString = XMLfunctions.getValue(e, "name");
  
  
  
           if ( nameMapString.toLowerCase().indexOf(searchTextString1.toLowerCase()) != -1 )   // != -1 means string is present in the search string
              {
                  map.put("id", XMLfunctions.getValue(e, "id"));
                  map.put("name",  XMLfunctions.getValue(e, "name"));
                  map.put("Score",  XMLfunctions.getValue(e, "score"));
                  mylist.add(map);
              }
      }
  
      ListAdapter adapter = new SimpleAdapter(this, mylist,
              R.layout.parsexml, new String[] { "name", "Score" }, new int[] {
                      R.id.item_title, R.id.item_subtitle });
  
      setListAdapter(adapter);
  
      final ListView lv = getListView();
      lv.setTextFilterEnabled(true);
      lv.setOnItemClickListener(new OnItemClickListener() {
          public void onItemClick(AdapterView&lt;?&gt; parent, View view,
                  int position, long id) {
              @SuppressWarnings("unchecked")
              HashMap&lt;String, String&gt; o = (HashMap&lt;String, String&gt;) lv
                      .getItemAtPosition(position);
  
  
                  Toast.makeText(Tab1Activity.this,
                           "Name "+o.get("name")+"  Clicked", Toast.LENGTH_LONG)
                          .show();                
  
          }
      });
  }
  </code></pre>