AsyncTask中的进度对话框
import java.util.ArrayList;import java.util.List;import com.cyberesa.info.BaseFeedParser;import com.cyberesa.info.Message; import com.cyberesa.info.MessageListAdapter;import com.cyberesa.info.R;import android.app.ListActivity;import android.os.Bundle; import android.util.Log;import android.widget.TextView;public class Soirees extends ListActivity { private List<Message> messages; private TextView tvSorties; private MyProgressDialog dialog; @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.sorties); tvSorties=(TextView)findViewById(R.id.TVTitle); tvSorties.setText("Programme des soirées"); loadFeed(); } private void loadFeed(){ try{ BaseFeedParser parser = new BaseFeedParser(); messages = parser.parse(); List<Message> titles = new ArrayList<Message>(messages.size()); for (Message msg : messages){ titles.add(msg); } MessageListAdapter adapter = new MessageListAdapter(this,titles); this.setListAdapter(adapter); adapter.notifyDataSetChanged(); } catch (Throwable t){ Log.e("ImageLoader",t.getMessage(),t); } }}
相关分类