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

  • Home
  • SEARCH
  • 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 4625376
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T03:15:48+00:00 2026-05-22T03:15:48+00:00

When using Microsft Exchange, Android activates its password screen wich the user needs to

  • 0

When using Microsft Exchange, Android activates its password screen wich the user needs to pass every time the device is turned on.

I am making a game which is using SurfaceView run by a thread. I am using many static variables. If the device is turned off while playing, when I come back and enter the password, the game screen shows but with some bitmaps having wrong size and is frozen.

In logs I see first NullPointerException with the non-UI thread then ANR error later. It looks like the turning the device off has destroyed some objects of my application yet it did not go through onCreate and the SurfaceView constructor again when it came back.

I have no problems when pausing the game with a phonecall or clicking HOME button. Also on two other devices the game works fine after turing them off and on in the middle of the play, but they don’t have the security screen.

I am using Galaxy Tab, os 2.2

EDIT:
After printing a stacktrace in the thread, I get

android.graphics.Canvas.throwIfRecycled

It seems that some of my bitmaps have been recycled. Any idea how to detect this in onResume or in surfaceChanged() which always fire on returning to the application?

  • 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-22T03:15:49+00:00Added an answer on May 22, 2026 at 3:15 am

    At the moment my solution to this problem is to close this activity if it is not resumed with the right sequence of events. If onSurfaceChanged happens without onSurfaceCreated happening first, then close this activity. The state of the game can still be preserved and when the player relaunch this activity it will continue where it stopped.

        @Override
        public void surfaceChanged(SurfaceHolder holder, int format, int width,
                int height) {
    
            //if it does not start through surfaceCreated close activity
           // because some bitmaps could be recycled and crash the application
            if (!surfaceCreatedFirst){
                _thread.setRunning(false); //stop the thread
                ((Activity) context1).finish(); //close activity
            }   
    
        }
    
        @Override
        public void surfaceCreated(SurfaceHolder holder) {
            surfaceCreatedFirst = true;
            _thread = new FootballThread(holder, this);
            _thread.setRunning(true);
            _thread.start(); 
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am able to read emails in from Microsoft Exchange using an IMAP Client
Using Microsoft SQL Server's database mirroring capability, can the mirroring occur between two clusters?
I am using Microsoft Access 2007 to move and massage some data between two
I'm using Microsoft.XMLHTTP to get some information from another server from an old ASP/VBScript
I am thinking about using Microsoft Unity for my Dependency Injection tool in our
We're using Microsoft.Practices.CompositeUI.EventBroker to handle event subscription and publication in our application. The way
I am using Microsoft Visual Web Developer 2008 Express. I've made an ASP.NET MVC
I am using Microsoft's CDO (Collaboration Data Objects) to programmatically read mail from an
I infrequently (monthly/quarterly) generate hundreds of Crystal Reports reports using Microsoft SQL Server 2005
I want to get started doing some game development using Microsoft's XNA. Part of

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.