I am trying to use the code written and uploaded by Fedor posted in this thread Lazy load of images in ListView (Source code: http://open-pim.com/tmp/LazyList.zip)
Fedor's project works well, but when I try to adapt the code to my project, things are not running well since I bumped to this exception (SocketException).
Somehow, I keep getting it even after setting the permission in the manifest to have Internet permission (and yes, I have an Internet connection working):
<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>
The exception: SocketException: Permission denied. Watch the LogCat details.
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)
The error /mnt/sdcard/ListViewTest/-421624214 (No such file or directory) is bugging me. I debugged my adaptation of Fedor's code and I don't see why the files are not found. I checked and confirmed the files I am trying to get do exist on the web.
By the way, the image uploader class is exactly the same. The main difference I see between my code and Fedor's code is that my main activity class extends ListActivity while and his extends BaseActivity.
I don't know if it solves your issue, but in your manifest, uses-permission directives should not be placed inside the uses-sdk directive.
Do you really have a file called "/mnt/sdcard/ListViewTest/-421624214" ???
Because that looks to me like someone sprintf'd a file name with %d instead of %s and it converted a pointer's value into a decimal int instead of de-referencing it to a string. (Or some comparable programmer type confusion in Java)
Also this is an error at accessing a local file, irrespective of what does or doesn't exist on the web.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With