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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:34:21+00:00 2026-06-15T20:34:21+00:00

When i run this code i get errors sometimes but not allways. I cant

  • 0

When i run this code i get errors sometimes but not allways.
I cant see my error.

Calling Code:

private void processPhotoUpdate(File tempFile)
        {
            Log.i(TAG, "Made it into Process Photo Update" );
            ProcessProfilePhotoTask task = new ProcessProfilePhotoTask()
                {
                    @Override
                    protected void onPostExecute(Bitmap result)
                        {
                            Log.i(TAG, "Not Null");
                            if (result != null){                    
                            Log.i(TAG, "on Post Execute");
                            android.widget.LinearLayout.LayoutParams params = new android.widget.LinearLayout.LayoutParams(result.getWidth(), result.getHeight());
                            params.gravity = Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL;
                            photo.setLayoutParams(params);
                            photo.setImageBitmap(result);
                            }
                        }
                };                  
                    task.execute(tempFile);
        }

The class i call is:

public class ProcessProfilePhotoTask extends AsyncTask<File, ProcessProfilePhotoTask.ProcessingState, Bitmap> {


public enum ProcessingState {
    STARTING,
    PROCESSING_LARGE,
    FINISHED
}


public static final String TAG = "ProcessProfilePhotoTask";

public ProcessProfilePhotoTask() {
    super();
}

@Override
protected Bitmap doInBackground(File... files) {
    ProcessingState[] s = new ProcessingState[1];
    //BitmapFactory.Options bmOptions = new BitmapFactory.Options();
    if (files.length != 1) {
        throw new IllegalArgumentException("We expect to process only one file");
    }
    try {
        s[0] = ProcessingState.PROCESSING_LARGE;
        publishProgress(s);

        Bitmap largePhoto = BitmapFactory.decodeStream(new FileInputStream(files[0]));
        int height = largePhoto.getHeight();
        int width = largePhoto.getWidth();
        int density = largePhoto.getDensity();
        Log.d(TAG,"large image processing "+ height+"x"+width+"den="+density+"type=");

        return largePhoto;
    } catch (FileNotFoundException e) {
        e.printStackTrace();
        return null;
    }
}
}

The LogCat is.

12-13 15:41:02.064: D/skia(14099): --- SkImageDecoder::Factory returned null
12-13 15:41:02.064: W/dalvikvm(14099): threadid=9: thread exiting with uncaught             exception (group=0x400259f8)
12-13 15:41:02.074: E/AndroidRuntime(14099): FATAL EXCEPTION: AsyncTask #1
12-13 15:41:02.074: E/AndroidRuntime(14099): java.lang.RuntimeException: An error     occured while executing doInBackground()
12-13 15:41:02.074: E/AndroidRuntime(14099):    at android.os.AsyncTask$3.done(AsyncTask.java:200)
12-13 15:41:02.074: E/AndroidRuntime(14099):    at     java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
12-13 15:41:02.074: E/AndroidRuntime(14099):    at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
12-13 15:41:02.074: E/AndroidRuntime(14099):    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
12-13 15:41:02.074: E/AndroidRuntime(14099):    at java.util.concurrent.FutureTask.run(FutureTask.java:137)
12-13 15:41:02.074: E/AndroidRuntime(14099):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
12-13 15:41:02.074: E/AndroidRuntime(14099):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
12-13 15:41:02.074: E/AndroidRuntime(14099):    at java.lang.Thread.run(Thread.java:1102)
12-13 15:41:02.074: E/AndroidRuntime(14099): Caused by: java.lang.NullPointerException
12-13 15:41:02.074: E/AndroidRuntime(14099):    at com.androidworks.ProcessProfilePhotoTask.doInBackground(ProcessProfilePhotoTask.java:57)
12-13 15:41:02.074: E/AndroidRuntime(14099):    at com.androidworks.ProcessProfilePhotoTask.doInBackground(ProcessProfilePhotoTask.java:1)
12-13 15:41:02.074: E/AndroidRuntime(14099):    at android.os.AsyncTask$2.call(AsyncTask.java:185)
12-13 15:41:02.074: E/AndroidRuntime(14099):    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
12-13 15:41:02.074: E/AndroidRuntime(14099):    ... 4 more
12-13 15:41:04.014: I/Process(14099): Sending signal. PID: 14099 SIG: 9
  • 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-15T20:34:22+00:00Added an answer on June 15, 2026 at 8:34 pm

    try this by adding this condition in doInBackgroud()….

    if(null != largePhoto)
    {
        // your code here
    }
    else
    {
       // error code here
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I run this code on IE8 or lower, I get this error: Object
I have this code and I couldn't run it because i get this error:
I get this error when I run the code below. I have normally used
This Java code compiles fine, but when I try to run it I get:
When I run this C code: // Get rid of the CRT and stuff;
When I try to run this code, I get incorrect maximums and minimums. Could
When I run this code to call the Google API, all I get is
I run this piece of code on Visual C++ 2010 char c[10]; cin.get(&c[0],5); cin.get(&c[2],4);
I run this code: - (void)unitButtonButtonTapped:(id)sender { [_label setString:@Last button: Unembossed square]; MilitaryUnits *target
I run this code here <html> <script type=text/javascript src=lib/jquery-ui-1.8.21.custom.min.js></script> <script src=http://127.0.0.1:5984/_utils/script/jquery.couch.js></script> <!--<script type=text/javascript src=lib/jquery-1.7.2.js></script>-->

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.