i am trying to add items to list and i want to start dialog bar before the start of the loop which add items to list and dismiss dialog after loop finish
     ProgressDialog pd;
     pd = new ProgressDialog(SearchList.this);
       pd.setTitle("Please wait");
       pd.setMessage("loading String.. ");
       pd.show();
    new Thread(new Runnable() {
    @Override
        public void run() {
        try {
                for (int i = 0; i <500000; i++) {
         list.add("String "+i);
         }
                pd.dismiss();
            } catch (Exception e) {
            }
        }
    }).start();
        m_adapter = new Adapter(this, R.layout.itemview, list);
    lv = (ListView) findViewById(R.id.listView1);
    lv.setAdapter(m_adapter);
 
     
     
     
    