1 class MyAdapter extends ArrayAdapter<String> {
 2         private int mResource;
 3         public MyAdapter(Context context, int textViewResourceId,
 4                 String[] objects) {
 5             super(context, textViewResourceId, objects);
 6             arrays = objects;
 7             mResource = textViewResourceId;
 8             mInflater = LayoutInflater.from(ListViewRefreshActivity.this);
 9             // TODO Auto-generated constructor stub
10         }
11         String[] arrays ;
12         private LayoutInflater mInflater;
13         @Override
14         public int getCount() {
15             // TODO Auto-generated method stub
16             return arrays.length;
17         }
18         @Override
19         public long getItemId(int position) {
20             // TODO Auto-generated method stub
21             return super.getItemId(position);
22         }
23         @Override
24         public String getItem(int position) {
25             // TODO Auto-generated method stub
26             return super.getItem(position);
27         }
28         @Override
29         public View getView(int position, View convertView, ViewGroup parent) {
30             TextView view;
31             // TODO Auto-generated method stub
32             if(convertView == null) {
33                 view = (TextView)mInflater.inflate(mResource, parent,false);
34             }else {
35                 view = (TextView)convertView;
36             }
37             view.setText(arrays[position].toString());
38             return view;
39         }
40         public void addDatas(String[] datas) {
41             String[] newArrays = new String[arrays.length+datas.length];
42             for(int i=0;i<arrays.length;i++) {
43                 newArrays[i] = arrays[i];
44             }
45             for(int i=0;i<datas.length;i++) {
46                 newArrays[arrays.length+i] = datas[i];
47             }
48             arrays = newArrays;
49             notifyDataSetChanged();
50         }
51     }
52 到时候你只要调用adapter.addDatas方法就可以了。如下:
53 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
54         // TODO Auto-generated method stub
55         super.onActivityResult(requestCode, resultCode, data);
56         String[] result = data.getStringArrayExtra("arrays");
57         adapter.addDatas(result);
58     }
59 实现的效果是,在list中增加几个item,当然你也可以根据需要更改逻辑,从而达到想要的效果,比如,替换新的item或者删除item,这都需要在自定义的adapter中实现。