学习笔记 estFilter.java public class TestFilter extends ListActivity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ArrayList<HashMap<String,String>> list = new ArrayList <HashMap<String, String>>(); HashMap<String, String> map1 = new HashMap<String, String>(); HashMap<String, String> map2 = new HashMap<String, String>(); HashMap<String, String> map3 = new HashMap<String, String>(); map1.put("name", "henly"); map1.put("age", "22"); map2.put("name", "john"); map2.put("age", "23"); map3.put("name", "lilei"); map3.put("age", "22"); list.add(map1); list.add(map2); list.add(map3); SimpleAdapter simpleAdapter = new SimpleAdapter(this, list, R.layout.user, new String[]{"name","age"}, new int[]{R.id.name,R.id.age}); String str = new String("22"); CharSequence constraint = str.subSequence(0, str.length()); Filter filter = simpleAdapter.getFilter(); //得到一个过滤器 filter.filter(constraint); //为该过滤器设置约束条件 setListAdapter(simpleAdapter); }
剩余20页未读,继续阅读
- 粉丝: 0
- 资源: 2
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- C语言-leetcode题解之70-climbing-stairs.c
- C语言-leetcode题解之68-text-justification.c
- C语言-leetcode题解之66-plus-one.c
- C语言-leetcode题解之64-minimum-path-sum.c
- C语言-leetcode题解之63-unique-paths-ii.c
- C语言-leetcode题解之62-unique-paths.c
- C语言-leetcode题解之61-rotate-list.c
- C语言-leetcode题解之59-spiral-matrix-ii.c
- C语言-leetcode题解之58-length-of-last-word.c
- 计算机编程课程设计基础教程