0

我在WeekDays.java中有以下代码

ArrayAdapter<TaskInAWeek> adapter1 = (ArrayAdapter<TaskInAWeek>) getListAdapter() ;
TaskInAWeek taski;
ArrayList<Long> checkedItms = new ArrayList<Long>();
ArrayList<Long> uncheckedItms = new ArrayList<Long>();

    for(int i=0;i<values.size();i++)
    {
        Log.i("value's size:" +values.size()," ");
        if(EditStatusAdapter.tog==1)
        {
            Log.i("i::"+i," ");
                taski = adapter1.getItem(i);
                long id = taski.getId();
                Log.i("nid:"+id," ");
                checkedItms.add(id);
            }
        else 
        {
            Log.i("i::"+i," ");
            taski = adapter1.getItem(i);
            long id = taski.getId();
            Log.i("nid:"+id," ");
            uncheckedItms.add(id);
        }
    }

它的自定义数组适配器是 EditStatusAdapter.java。我NullPointerException在这个 pt得到一个taski = adapter1.getItem(i);

我在我的一项活动中使用了类似的,但它确实工作得很好。我猜它是由于自定义数组适配器。但我也不能忽视它。谁能告诉我如何清除异常?

4

0 回答 0