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 8855143
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:03:43+00:00 2026-06-14T14:03:43+00:00

I am using Base64 for taking picture from camera as well as picking image

  • 0

I am using Base64 for taking picture from camera as well as picking image from SDcard, while saving image in imageview I am getting OutOfMemoryError. Below is error log. Please Help.

ERROR LOG

11-20 15:58:50.098: E/AndroidRuntime(4790): FATAL EXCEPTION: main
11-20 15:58:50.098: E/AndroidRuntime(4790): java.lang.OutOfMemoryError
11-20 15:58:50.098: E/AndroidRuntime(4790):     at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
11-20 15:58:50.098: E/AndroidRuntime(4790):     at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:500)
11-20 15:58:50.098: E/AndroidRuntime(4790):     at android.graphics.BitmapFactory.decodeFile(BitmapFactory.java:306)
11-20 15:58:50.098: E/AndroidRuntime(4790):     at android.graphics.BitmapFactory.decodeFile(BitmapFactory.java:331)
11-20 15:58:50.098: E/AndroidRuntime(4790):     at com.Infoicon.KidsBSafeNew.MainActivity.onActivityResult(MainActivity.java:606)
11-20 15:58:50.098: E/AndroidRuntime(4790):     at android.app.Activity.dispatchActivityResult(Activity.java:4649)
11-20 15:58:50.098: E/AndroidRuntime(4790):     at android.app.ActivityThread.deliverResults(ActivityThread.java:2996)
11-20 15:58:50.098: E/AndroidRuntime(4790):     at android.app.ActivityThread.handleSendResult(ActivityThread.java:3043)
11-20 15:58:50.098: E/AndroidRuntime(4790):     at android.app.ActivityThread.access$1100(ActivityThread.java:127)
11-20 15:58:50.098: E/AndroidRuntime(4790):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1188)
11-20 15:58:50.098: E/AndroidRuntime(4790):     at android.os.Handler.dispatchMessage(Handler.java:99)
11-20 15:58:50.098: E/AndroidRuntime(4790):     at android.os.Looper.loop(Looper.java:137)
11-20 15:58:50.098: E/AndroidRuntime(4790):     at android.app.ActivityThread.main(ActivityThread.java:4441)
11-20 15:58:50.098: E/AndroidRuntime(4790):     at java.lang.reflect.Method.invokeNative(Native Method)
11-20 15:58:50.098: E/AndroidRuntime(4790):     at java.lang.reflect.Method.invoke(Method.java:511)
11-20 15:58:50.098: E/AndroidRuntime(4790):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
11-20 15:58:50.098: E/AndroidRuntime(4790):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
11-20 15:58:50.098: E/AndroidRuntime(4790):     at dalvik.system.NativeStart.main(Native Method)
11-20 15:58:50.118: E/System(4790): java.lang.IllegalStateException: Don't have database lock!
11-20 15:58:50.118: E/System(4790):     at android.database.sqlite.SQLiteDatabase.verifyLockOwner(SQLiteDatabase.java:2090)
11-20 15:58:50.118: E/System(4790):     at android.database.sqlite.SQLiteDatabase$1.entryRemoved(SQLiteDatabase.java:2182)
11-20 15:58:50.118: E/System(4790):     at android.database.sqlite.SQLiteDatabase$1.entryRemoved(SQLiteDatabase.java:2178)
11-20 15:58:50.118: E/System(4790):     at android.util.LruCache.trimToSize(LruCache.java:197)
11-20 15:58:50.118: E/System(4790):     at android.util.LruCache.evictAll(LruCache.java:285)
11-20 15:58:50.118: E/System(4790):     at android.database.sqlite.SQLiteDatabase.deallocCachedSqlStatements(SQLiteDatabase.java:2143)
11-20 15:58:50.118: E/System(4790):     at android.database.sqlite.SQLiteDatabase.closeClosable(SQLiteDatabase.java:1126)
11-20 15:58:50.118: E/System(4790):     at android.database.sqlite.SQLiteDatabase.finalize(SQLiteDatabase.java:1914)
11-20 15:58:50.118: E/System(4790):     at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:182)
11-20 15:58:50.118: E/System(4790):     at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:168)
11-20 15:58:50.118: E/System(4790):     at java.lang.Thread.run(Thread.java:856)
  • 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-06-14T14:03:44+00:00Added an answer on June 14, 2026 at 2:03 pm

    use this..

    in onActivityresult..

     @Override
     protected void onActivityResult(int requestCode, int resultcode, Intent intent)
     {
         super.onActivityResult(requestCode, resultcode, intent);
    if(requestCode == 1)
         {
    File out = new File(Environment.getExternalStorageDirectory(), "newImage.jpg");
    
             if(!out.exists())
             {
              Log.v("log", "file not found");
              Toast.makeText(getBaseContext(),
    
              "Error while capturing image", Toast.LENGTH_LONG)
    
              .show();
    
            return;
    
           }
    
             Log.v("log", "file "+out.getAbsolutePath());
             File f = new File(out.getAbsolutePath());
    
             try {
    
        ExifInterface exif = new ExifInterface(out.getAbsolutePath());
         orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, 1);
        //Toast.makeText(getApplicationContext(), ""+orientation, 1).show();
        Log.v("log", "ort is "+orientation);
    
       } catch (IOException e)
       {
        e.printStackTrace();
       }
              Bitmap photo =decodeFile(f,400,400);////after this use base64 to convet image because this function will do your file size in very normal size..so, outofMemory error not occured..
    
    
     }
    }
    

    and this is decode function..

    public static Bitmap decodeFile(File f,int WIDTH,int HIGHT){
         try {
             //Decode image size
             BitmapFactory.Options o = new BitmapFactory.Options();
             o.inJustDecodeBounds = true;
             BitmapFactory.decodeStream(new FileInputStream(f),null,o);
    
             //The new size we want to scale to
             final int REQUIRED_WIDTH=WIDTH;
             final int REQUIRED_HIGHT=HIGHT;
             //Find the correct scale value. It should be the power of 2.
             int scale=1;
             while(o.outWidth/scale/2>=REQUIRED_WIDTH && o.outHeight/scale/2>=REQUIRED_HIGHT)
                 scale*=2;
    
             //Decode with inSampleSize
             BitmapFactory.Options o2 = new BitmapFactory.Options();
             o2.inSampleSize=scale;
             return BitmapFactory.decodeStream(new FileInputStream(f), null, o2);
         } catch (FileNotFoundException e) {}
         return null;
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want get the image from an xml file which is encoded using base64.
I want to display image using base64 encoding in IE using GWT If it
I am uploading image to server using base64 its working fine if image is
I am trying to convert a base64 encoded string to an image object using
Using Base64 from Apache commons public byte[] encode(File file) throws FileNotFoundException, IOException { byte[]
For small size image what's (if any) the benefit in loading time using base64
I'm trying to encode an image using base64 in Node.JS to pass along to
I'm saving some of my image in to mysql database using base64_encode . now
I'm creating a link shortening service and I'm using base64 encoding/decoding of an incremented
I'm using MD5 function and Base64 Encoding to generate a User Secret (used to

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.