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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:48:07+00:00 2026-06-10T10:48:07+00:00

I know this question has been asked quite often, but this seems to be

  • 0

I know this question has been asked quite often, but this seems to be different. I’ve tried 6 solutions from StackOverflow and it didn’t work. I’m trying to put the drawing someone made into a Notification.BigPictureStyle when they leave the app.

    public void surfaceCreated(SurfaceHolder holder) {
        // TODO Auto-generated method stub
        _thread.setRunning(true);
        _thread.start();            
        setDrawingCacheEnabled(true);
    }

    public void surfaceDestroyed(SurfaceHolder holder) {
        // TODO Auto-generated method stub
        _thread.setRunning(false);

        measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED),
                MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
        layout(0, 0, getMeasuredWidth(), getMeasuredHeight());

        buildDrawingCache(false);
        Bitmap currentState = Bitmap.createBitmap(getDrawingCache());
        setDrawingCacheEnabled(false);

        NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

        Intent notificationIntent = new Intent(DrawActivity.this, DrawActivity.class);
        PendingIntent contentIntent = PendingIntent.getActivity(DrawActivity.this, 0, notificationIntent, Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);

        Notification noti = new Notification.BigPictureStyle(
                new Notification.Builder(DrawActivity.this)
                    .setContentTitle("Your drawing")
                    .setContentText("Unfold to see drawing")
                    .setWhen(System.currentTimeMillis())
                    .setSmallIcon(R.drawable.ic_launcher)
                    .setContentIntent(contentIntent))
        .setSummaryText("Here you can see how you left your drawing.")
        .bigPicture(currentState)
        .build();

        manager.notify(1023, noti);

    }
}

But I always get a NullPointerException at this line:

Bitmap currentState = Bitmap.createBitmap(getDrawingCache());

This code is from StackOverflow with enabling all these caches. Can someone see what’s wrong?

By the way, I’m using Android 4.1.1 of course.

  • 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-10T10:48:08+00:00Added an answer on June 10, 2026 at 10:48 am

    Similar question here more info here…

    Problem appears to be that you can’t access contents of a surfaceview – apparently you can capture the contents of an ImageView… I assume your using a surfaceView and thus encountering the same problem… If your willing to dig further this might help (from one of the above threads/topics)

    If your not using a surfaceview then setLayerType might be your answer…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this question has been asked before, but non of the solutions solve
I know this question has been asked several times, but I can't quite seem
I know this question has been asked before but the solutions did not work
I know this question has been asked before, but I tried eveything and can't
I know this question has been asked many times. But from what I read,
I know this question has been asked before but the other solutions didn't work
I know this question has been asked a zillion times, but I still feel
I know this question has been asked before, but I haven't been able to
I know this question has been asked before numorous times but they seem to
I know this question has been asked countless of times. But none of them

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.