相关疑难解决方法(0)

使用EditText在ListView中搜索

我有一个ListView.它的每一行包含3 TextView和2 Button.在它上面我有一个EditText.如何按每行ListView第一TextView行的值过滤我的?

android

7
推荐指数
1
解决办法
2万
查看次数

删除ArrayList上的元素会在ArrayAdapter上抛出IndexOutOfBoundsException

我正在开发一个Android 3.1应用程序.

我有自定义ArrayAdapter.我想在ListView中显示名称列表.

这些名称是可以下载并在本地保存的表单.当用户下载并保存一个或多个时,我打电话updateFormsNotDownloaded().但是当我这样做时,我得到一个IndexOutOfBoundsException.我认为这个问题是因为我打电话notifyDataSetChanged().

看看我的代码:

public class FormAdapter extends ArrayAdapter<Form>
{
    private Context context;
    private int layoutResourceId;
    private List<Form> forms;
    private ArrayList<Integer> checkedItemsPosition;
    private Button downloadButton;

    public ArrayList<Integer> getCheckedItemsPosition()
    {
        return checkedItemsPosition;
    }

    public String[] getSelectedFormsId()
    {
        String[] ids = new String[checkedItemsPosition.size()];
        int i = 0;
        for(Integer pos : checkedItemsPosition)
        {
            Form f = forms.get(pos.intValue());
            ids[i] = f.FormId;
            i++;
        }
        return ids;
    }

    /**
     * Called when selected forms has been downloaded and save it locally …
Run Code Online (Sandbox Code Playgroud)

android android-arrayadapter indexoutofboundsexception

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