"resolveuri Failed On Bad Bitmap Uri" When Putting Image On Listview
hey, i'm new to android and i have a slight problem. i'm trying to put together a listview with images are loaded through a URL. this works so far, but the images wont show up. log
Solution 1:
I have resolved this issue. I am using the code to solve the issue.
Here 'Path' is a local file System path that can be got using: Environment.getExternalStorageDirectory().getAbsolutePath()
publicstatic String loadImageFromWebOperations(String url, String path) {
try {
InputStream is = (InputStream) new URL(url).getContent();
System.out.println(path);
File f = new File(path);
f.createNewFile();
FileOutputStream fos = new FileOutputStream(f);
try {
byte[] b = newbyte[100];
int l = 0;
while ((l = is.read(b)) != -1)
fos.write(b, 0, l);
} catch (Exception e) {
}
return f.getAbsolutePath();
} catch (Exception e) {
System.out.println("Exc=" + e);
returnnull;
}
}
Hope this helps :).
Baca Juga
Post a Comment for ""resolveuri Failed On Bad Bitmap Uri" When Putting Image On Listview"