小编use*_*012的帖子

过滤自定义适配器IndexOutOfBoundsException

我是android的新手.

我的自定义适配器在过滤时导致异常

这是我的代码.private class DeptAdapter extends ArrayAdapter implements Filterable {

    private ArrayList<Dept> items;
    private ArrayList<Dept> mOriginalValues;

    public DeptAdapter(Context context, int textViewResourceId, ArrayList<Dept> items) {
            super(context, textViewResourceId, items);
            this.items = items;
    }
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View v = convertView;

        if (v == null) {
            LayoutInflater vi = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            v = vi.inflate(R.layout.item_listview_2line, null);
        }
        Dept d = items.get(position);
        if (d != null) {
                TextView tt = (TextView) v.findViewById(R.id.toptext);
                TextView bt = (TextView) v.findViewById(R.id.bottomtext);
                if (tt …
Run Code Online (Sandbox Code Playgroud)

android filter custom-adapter

8
推荐指数
1
解决办法
2725
查看次数

在开发Android游戏时,NDK是否需要良好的性能?

我听说如果我不使用NDK开发Android游戏,性能就会明显降低.这是真的吗?

android android-ndk

6
推荐指数
2
解决办法
2059
查看次数

标签 统计

android ×2

android-ndk ×1

custom-adapter ×1

filter ×1