Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7546129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:07:13+00:00 2026-05-30T09:07:13+00:00

So my latest app runs into this problem where it complains in the logcat

  • 0

So my latest app runs into this problem where it complains in the logcat that theres no room left on the device to save files but that is definitely not the case as I can close my app open the stock camera and take a picture. How has everybody else dealt with this problem.

Edit: The error occurs in this method

    private void writeFile(Bitmap bmp, File f) {
    FileOutputStream out = null;

    try {
        out = new FileOutputStream(f);
        bmp.compress(Bitmap.CompressFormat.PNG, 80, out);//<---error here
    } catch (NullPointerException e) {
        e.printStackTrace();
        Log.w("nullpointerException on image error", "nullpointer");
    } catch (FileNotFoundException e) {
        Log.w("fileNotfoundException on image error", "filenotfound");
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    finally { 
        try { if (out != null ) out.close(); }
        catch(Exception ex) {} 
    }
}

and this is the logcat report on this error:

java.io.IOException: no space left on device
at org.apache.harmony.luni.platform.OSFileSystem.write(Native Method)
at dalvik.system.BlockGuard$WrappedFileSystem.write(BlockGuard.java:171)
at java.io.FileOutputStream.write(FileOutputStream.java:300)
at android.graphics.Bitmap.nativeCompress(Native Method)
at data.ImageManager.writeFile(ImageManager.java:215)
at data.ImageManager.getBitmap(ImageManager.java:192)
at data.ImageManager.access$1(ImageManger.java:102)
at data.ImageManager$ImageQueueManager.run(ImageManager.java:290)
at java.lang.Thread.run(Thread.java:1019)

Edit: Heres how I though you create a directory on external memory

This is what Im using to create the place that I thought would be the sd card

    String sdState = android.os.Environment.getExternalStorageState();
    if (sdState.equals(android.os.Environment.MEDIA_MOUNTED)) {
        File sdDir = android.os.Environment.getExternalStorageDirectory();      
        cacheDir = new File(sdDir,"data/gr");
    }
    else
        cacheDir = context.getExternalCacheDir();

    if(!cacheDir.exists())
        cacheDir.mkdirs();


    if(sdState.equals(android.os.Environment.MEDIA_MOUNTED)){
        File adSdDir =     android.os.Environment.getExternalStorageDirectory();
        adCacheDir = new File(adSdDir,"data/ad");
    }else
        adCacheDir = context.getExternalCacheDir();

    if(!adCacheDir.exists())
        adCacheDir.mkdirs();
}

and then in the method that I look for or create the image to go into the directory:

 private Bitmap getBitmap(ImgRequestObj ids) {
    String url = null;
    String filename = ids.objId.toString();
    File f = null;

    try{
        if(ids.objName.equals("mark")){
            url = graffMarksURL;
            f = new File(cacheDir, filename);
        }else if(ids.objName.equals("admark")){
            url = adMarksURL;
            f = new File(adCacheDir, filename);
        }



    // Is the bitmap in our cache?
    Bitmap bitmap = BitmapFactory.decodeFile(f.getPath());
    if(bitmap != null) return bitmap;

    // Nope, have to download it
    try {   
            BitmapFactory.Options bfOptions=new BitmapFactory.Options();

            bfOptions.inDither=false;                     //Disable Dithering mode

            bfOptions.inPurgeable=true;                   //Tell to gc that whether it needs free memory, the Bitmap can be cleared

            bfOptions.inInputShareable=true;              //Which kind of reference will be used to recover the Bitmap data after being clear, when it will be used in the future


            DefaultHttpClient client;
            HttpResponse response = null;
            HttpParams params = null;// new Http parameters to be used for extra buffering room in VM
            HttpPost post = null;
            InputStream is = null;
            BufferedInputStream bis = null;
            Bitmap bmp = null;
            ArrayList<NameValuePair> nvp1 = new ArrayList<NameValuePair>();

            nvp1.add(new BasicNameValuePair("id", ids.objId.toString()));
            // - martin passing id to php script select statement
             client = new DefaultHttpClient();

            try {

                post = new HttpPost(url);
                params = post.getParams();//Setting the new Http params to post
                post.setEntity(new UrlEncodedFormEntity(nvp1));
                try{
                HttpConnectionParams.setSocketBufferSize(params, 8192);//Defining the new buffer size
                response = client.execute(post);

                }
                catch(HttpResponseException e){
                    e.getCause();
                                    }
            //Capture response from query and prepare as input
            HttpEntity entity = response.getEntity();
            // move content to Input Stream
                is = entity.getContent();

            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

                bis = new BufferedInputStream(is);
                try{
                bmp = BitmapFactory.decodeStream(bis, null, bfOptions);
                }finally{}

                    if( is != null )
                        try {
                            is.close();
                            //response = null;
                        } catch (IOException e) {
                            // TODO Auto-generated catch block
                            e.printStackTrace();
                        }
                    //Log.w("inputstream of image closed", "for this image "+id.toString());
                    if( bis != null )
                        try {
                            //response = null;
                            bis.close();
                        } catch (IOException e) {
                            // TODO Auto-generated catch block
                            e.printStackTrace();
                        }
                    bitmap = bmp;
                    writeFile(bitmap, f);
                    try{
                        bmp = null;
                    }catch(NullPointerException e){
                        e.printStackTrace();
                    }
                    return bitmap;}
                catch(Exception e){
            e.printStackTrace();
            }
        return bitmap;
    }catch(NullPointerException e){
        e.printStackTrace();
    }
    return null;
        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T09:07:14+00:00Added an answer on May 30, 2026 at 9:07 am

    you are actually using internal memory by using getCacheDir() in your else statement. However, if you want to store large data then its recommended to use getExternalCacheDir() because not all android phones have huge internal storage, but they do/may have bigger external storage.

    if (sdState.equals(android.os.Environment.MEDIA_MOUNTED)) { 
       File sdDir = context.getExternalCacheDir();
       cacheDir = new File(sdDir,"data"); 
    } 
    else 
       Log.e("storage", "SD card not found");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to implement django-filebrowser into my latest app. I have grappelli installed also.
I have a console app that runs a self hosted WCF Data Service. I
I have an app that runs ok on emulator, I tried to install it
I have a WiX installer that runs a program that downloads the latest version
I am running into another problem with my Iphone App which I just can't
I'm running into the following problem when trying to run an app wiht grails
The latest Google App Engine release supports a new Task Queue API in Python.
I started deploying my latest RoR app on Heroku , which required me to
I'm using the latest tools provided by the latest Google App Engine (GAE) environment,
I am using latest Pyramid to build a web app. Somehow we have started

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.