相关疑难解决方法(0)

过滤自定义适配器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,将项目排序为u类型

我有一个带有搜索栏的列表视图,我想在编辑文本中键入文本时对项目进行排序.我一直试图这样做,但是无法完成,你能帮我做吗?我要感谢你提前感谢

search android listview

0
推荐指数
1
解决办法
5124
查看次数

使用getFilter函数时,ListView为空白

我想实现getFilter()我的功能ListView,但每次我输入的东西EditTextListView就会消失.

我的SetHelpRows档案:

public class SetHelpRows {
    String name;
    String id;

    public String getName () {
        return name;
    }

    public void setName (String name) {
        this.name = name;
    }

    public String getID () {
        return id;
    }

    public void setID (String id) {
        this.id = id;
    }

    public SetHelpRows(String name, String id) {
        super();
        this.name = name;
        this.id = id;
    }
}
Run Code Online (Sandbox Code Playgroud)

我的SetHelpRowsCustomAdapter档案:

import java.util.ArrayList;

import android.app.Activity;
import android.content.Context; …
Run Code Online (Sandbox Code Playgroud)

java android listview

0
推荐指数
1
解决办法
5083
查看次数

标签 统计

android ×3

listview ×2

custom-adapter ×1

filter ×1

java ×1

search ×1