对话框,适配器和数据更改

时间:2011-07-24 12:01:55

标签: java android dataadapter

我有一个使用此代码适配器的自定义警告对话框

adapter_nomi = new ArrayAdapter<nomi>(context, R.layout.dialog_lista_nomi, R.id.r_dialog_nomi, list_nomi){

                    @Override
                    public View getView(int position, View convertView,ViewGroup parent) {
                            ViewHolder holder = null;
                            final String indirizzo;
                            if(convertView==null){
                                    LayoutInflater inflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                                    convertView = inflater.inflate(R.layout.row_dialog_nomi, null);
                                    holder = new ViewHolder();
                                    holder.nome = (TextView)convertView.findViewById(R.id.r_dialog_nomi);
                                    convertView.setTag(holder);
                            }else{
                                    holder = (ViewHolder)convertView.getTag();
                            }
                            nomi item = getItem(position);
                            holder.nome.setText(item.get("nominativo"));
                            return convertView;
                    }
            };

但是当list_nomi改变并且我调用showDialog时它不会刷新。我还在onPrepareDialog中输入了代码adapter_nomi.notifyDataSetChange();但它不起作用.....为什么?

0 个答案:

没有答案