我试图使用Fedor在这个帖子中发布的代码和上传的代码
Lazy load of images in ListView(源码: http://open-pim.com/tmp/LazyList.zip)
Lazy load of images in ListView(源码: http://open-pim.com/tmp/LazyList.zip)
Fedor的项目运行良好,但是当我尝试将代码调整到我的项目时,由于我碰到了这个异常(SocketException),所以事情运行得不好.
不知何故,即使在清单中设置权限以获得Internet权限之后,我仍然继续获取它(是的,我有一个Internet连接工作):
<uses-sdk android:minSdkVersion="8"> <uses-permission android:name="android.permission.INTERNET"></uses-permission> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission> </uses-sdk>
例外:SocketException:权限被拒绝.观看LogCat详细信息.
09-24 23:43:00.591: ERROR/File was not found.(1124): /mnt/sdcard/ListViewTest/-421624214 (No such file or directory) 09-24 23:43:00.601: WARN/System.err(1124): java.net.SocketException: Permission denied 09-24 23:43:00.611: WARN/System.err(1124): at org.apache.harmony.luni.platform.OSNetworkSystem.createStreamSocketImpl(Native Method) 09-24 23:43:00.611: WARN/System.err(1124): at org.apache.harmony.luni.platform.OSNetworkSystem.createStreamSocket(OSNetworkSystem.java:186) 09-24 23:43:00.622: WARN/System.err(1124): at org.apache.harmony.luni.net.PlainSocketImpl.create(PlainSocketImpl.java:265) 09-24 23:43:00.632: WARN/System.err(1124): at java.net.Socket.checkClosedAndCreate(Socket.java:873) 09-24 23:43:00.632: WARN/System.err(1124): at java.net.Socket.connect(Socket.java:1020) 09-24 23:43:00.632: WARN/System.err(1124): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.<init>(HttpConnection.java:62) 09-24 23:43:00.642: WARN/System.err(1124): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionPool.get(HttpConnectionPool.java:88) 09-24 23:43:00.642: WARN/System.err(1124): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getHTTPConnection(HttpURLConnectionImpl.java:927) 09-24 23:43:00.652: WARN/System.err(1124): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:909) 09-24 23:43:00.661: WARN/System.err(1124): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:1152) 09-24 23:43:00.661: WARN/System.err(1124): at java.net.URL.openStream(URL.java:653) 09-24 23:43:00.661: WARN/System.err(1124): at fabiomilheiro.tests.ImageLoader.getBitmap(ImageLoader.java:80) 09-24 23:43:00.671: WARN/System.err(1124): at fabiomilheiro.tests.ImageLoader.access$0(ImageLoader.java:66) 09-24 23:43:00.671: WARN/System.err(1124): at fabiomilheiro.tests.ImageLoader$PhotosLoader.run(ImageLoader.java:173)
错误/ mnt / sdcard / ListViewTest / -421624214(没有这样的文件或目录)让我烦恼.我调试了我对Fedor代码的改编,我不明白为什么找不到这些文件.我检查并确认了我试图在网上存在的文件.
顺便说一句,图像上传器类完全相同.我在代码和Fedor代码之间看到的主要区别是我的主要活动类扩展了ListActivity,而他扩展了BaseActivity.
解决方法
我不知道它是否解决了您的问题,但在您的清单中,uses-permission指令不应放在uses-sdk指令中.