12

I am getting the following message in android LogCat

03-20 01:45:03.362: WARN/System.err(369): java.io.FileNotFoundException: /mnt/sdcard/LazyList/-2012431329 (No such file or directory)
03-20 01:45:03.362: WARN/System.err(369):     at org.apache.harmony.luni.platform.OSFileSystem.open(Native Method)
03-20 01:45:03.372: WARN/System.err(369):     at dalvik.system.BlockGuard$WrappedFileSystem.open(BlockGuard.java:232)
03-20 01:45:03.382: WARN/System.err(369):     at java.io.FileOutputStream.<init>(FileOutputStream.java:94)
03-20 01:45:03.382: WARN/System.err(369):     at java.io.FileOutputStream.<init>(FileOutputStream.java:66)
03-20 01:45:03.392: WARN/System.err(369):     at com.ImageLoaders.ImageLoader.getBitmap(ImageLoader.java:86)

For downloading images in android emulator I have added internet permission in androidManifest.xml file, but looks like it is not working. I have also given 10MB space to android emulator as well.

any one guide me what could be the problem? thanks in advance.

3
  • Do you have a file with called /mnt/sdcard/LazyList/-2012431329? Commented Mar 19, 2011 at 13:58
  • Try new java.io.File("/mnt/sdcard/LazyList/-2012431329").exists(); Does it say true or false? Commented Mar 19, 2011 at 14:43
  • This problem has already been solved here : stackoverflow.com/a/36336679/5832032 Commented Mar 31, 2016 at 14:52

3 Answers 3

29

I solved this problem adding permissions:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Sign up to request clarification or add additional context in comments.

Comments

1

ImageLoader Constructor should be change to this.

public ImageLoader(Context context) {
    // Make the background thead low priority. This way it will not affect
    // the UI performance
    photoLoaderThread.setPriority(Thread.NORM_PRIORITY - 1);

    // Find the dir to save cached images
    if (android.os.Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED))
        cacheDir = new File(context.getCacheDir(), "LazyList");
    else
        cacheDir = context.getCacheDir();
    if (!cacheDir.exists())
        cacheDir.mkdirs();
}

By default it is like this

cacheDir = new File(android.os.Environment.getDataDirectory(), "LazyList");

You should change it to

cacheDir = new File(context.getCacheDir(), "LazyList");

I solved my problem 100% in android 2.1.

Comments

0

You seem to search for the following directory or file:

/mnt/sdcard/LazyList/-2012431329

This is looking a little bit weird. This file or directory can't be found since it's not a valid name. Are you sure that this is the correct name?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.