解决方案 »

  1.   

    虽然是说文件找不到,但是他找不到的文件是跟的一个内存地址,与路径没有关系你看我的代码里面都写了如果路径有问题会直接跳过
    if (!new File(filePath).exists()) {
                continue;
            }
      

  2.   

    虽然是说文件找不到,但是他找不到的文件是跟的一个内存地址,与路径没有关系你看我的代码里面都写了如果路径有问题会直接跳过
    if (!new File(filePath).exists()) {
                continue;
            }
    有时是这样的,文件在,但是你没有权限读取,也会导致这样的错误,文件是在哪的?
      

  3.   

    虽然是说文件找不到,但是他找不到的文件是跟的一个内存地址,与路径没有关系你看我的代码里面都写了如果路径有问题会直接跳过
    if (!new File(filePath).exists()) {
                continue;
            }
    有时是这样的,文件在,但是你没有权限读取,也会导致这样的错误,文件是在哪的?
    文件在来着权限也有,可以通过另外的方式查看到我好像已经找到可行的解决方法了,正在试,成功了贴出来。。
      

  4.   

    对的。。已然找到方法,贴出来分享。。首先我的程序里面用到了SimpleAdapter 这个类,在SDK源码里面看了一下,里面有一个方法如下:private void bindView(int position, View view) {
            final Map dataSet = mData.get(position);
            if (dataSet == null) {
                return;
            }        final ViewBinder binder = mViewBinder;
            final String[] from = mFrom;
            final int[] to = mTo;
            final int count = to.length;        for (int i = 0; i < count; i++) {
                final View v = view.findViewById(to[i]);
                if (v != null) {
                    final Object data = dataSet.get(from[i]);
                    String text = data == null ? "" : data.toString();
                    if (text == null) {
                        text = "";
                    }                boolean bound = false;
                    if (binder != null) {
                        bound = binder.setViewValue(v, data, text);
                    }                if (!bound) {
                        if (v instanceof Checkable) {
                            if (data instanceof Boolean) {
                                ((Checkable) v).setChecked((Boolean) data);
                            } else if (v instanceof TextView) {
                                // Note: keep the instanceof TextView check at the bottom of these
                                // ifs since a lot of views are TextViews (e.g. CheckBoxes).
                                setViewText((TextView) v, text);
                            } else {
                                throw new IllegalStateException(v.getClass().getName() +
                                        " should be bound to a Boolean, not a " +
                                        (data == null ? "<unknown type>" : data.getClass()));
                            }
                        } else if (v instanceof TextView) {
                            // Note: keep the instanceof TextView check at the bottom of these
                            // ifs since a lot of views are TextViews (e.g. CheckBoxes).
                            setViewText((TextView) v, text);
                        } else if (v instanceof ImageView) {
                            if (data instanceof Integer) {
                                setViewImage((ImageView) v, (Integer) data);                            
                            } else {
                                setViewImage((ImageView) v, text);
                            }
                        } else {
                            throw new IllegalStateException(v.getClass().getName() + " is not a " +
                                    " view that can be bounds by this SimpleAdapter");
                        }
                    }
                }
            }
        }这里面当控件是ImageView的时候,他只分了两种情况,一种是资源ID,一种是文件地址,我传入的数据是Bitmap类型的数据,在这里当然就当成了文件地址来处理,自然就会有FileNotFoundException。知道了原因,解决方案就呼之欲出了,就是自己重写这个类,增加一种情况当数据类型是Bitmap的时候怎么处理,然后就轻松自在的解决了,代码我就不贴了,因为确实没什么好贴的,找到了原因,解决方案实在不值一提
      

  5.   

    解决方法找到,结贴了,多谢这位大哥的热心帮助对于Adapter ,基本上都是重载,里面的方法自己实现