登录 注册
当前位置:主页 > 资源下载 > 9 > Android课件资料

Android课件资料

  • 更新:2024-09-02 19:53:14
  • 大小:6MB
  • 推荐:★★★★★
  • 来源:网友上传分享
  • 类别:Android - 移动开发
  • 格式:PPT

资源介绍

学习笔记 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> list = new ArrayList >(); HashMap map1 = new HashMap(); HashMap map2 = new HashMap(); HashMap map3 = new HashMap(); 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); }