1

我在 onCreate 中为 listview 设置了一个 mydapter 为:

    ArrayAdapter mydapter;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
   mydapter = new MyAdapter(this, R.layout.grid002);
            list = (ListView) findViewById(R.id.list002);
            list.setAdapter(mydapter);

}

我创建了一个对话框: private void showDiaglogE003() {

        try {
            final Dialog dialoge3;
            dialoge3 = new Dialog(this);            
            dialoge3.setContentView(R.layout.layoutdialoge003);         
            Button btnCacnel = (Button) dialoge3.findViewById(R.id.btnE3Cancel);
            btnCacnel.setOnClickListener(new OnClickListener() {

                public void onClick(View v) {
                    // TODO Auto-generated method stub
                     dialoge3.cancel();
                    mydapter.notifyDataSetChanged();
                }
            });
    dialoge3.show();
}

但是当我调用notifyDataSetChangedmydapter 时,listview 不会改变。你能帮助我吗?

4

0 回答 0