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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:22:16+00:00 2026-06-14T18:22:16+00:00

I got an Activity class that uses two other classes; one of them extending

  • 0

I got an Activity class that uses two other classes; one of them extending ImageView and one that extends BaseAdapter like so:
Like so

My ImageView class does some progresses when it is called and when I am starting it for the first time it does what I want it to. This is also the case if I press home button and then resumes.
But for some reason it does not work if I resume from standby mode. (pressing the button on the phone that makes the screen dark) When I unlock the phone it crashes. It crashes on a nullPointerException, and from what I can read when I try to call getChildAt() on a GridView defined by the BaseAdapter.

Is it any way to make the app do the same as when I press the home button, as when I set the phone in standby mode?
EDIT:

public MyCustomDefinedImageViewClass (Context context) {
super (context);
mContext = context;
    MyCustomDefinedImageViewClass someThing =(MyCustomDefinedImageViewClass)gridViewIGetTheChildFrom.getChildAt(some int);

}
This is what is causing my crash:

 11-19 22:00:48.200: E/AndroidRuntime(6252):     at my.package.name.MyCustomDefinedImageViewClass.<init>(MyCustomDefinedImageViewClass.java:57)

I do not think the code is helping to much and that was why I did not post it in the first place.

  • 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-14T18:22:18+00:00Added an answer on June 14, 2026 at 6:22 pm

    Try adding

    android:configChanges="keyboardHidden|orientation|screenLayout"
    

    to your manifest file. The crash is a result of activity restart when the lock screen comes up. The lock screen forces portrait orientation and if you are not ready to handle it then your app may crash.

    If that doesn’t do it, try overriding onRetainNonConfigurationInstance().

    See this post for info on how to retain objects: How to save lot of object in onRetainNonConfigurationInstance() in android

    Also read this android-group thread for understanding what happens when device goes to sleep.

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

Sidebar

Related Questions

I have a class that extends Activity and within it got a private class
I'm trying to create DatePicker dialog from a class that doesn't extends the Activity
I've got a basic Activity class, which creates a GLSurfaceView and that is passed
I got an Activity that contains a CustomImage (extends View) on which i try
I got an activity and a service that are binded. When the onServiceConnected is
i've got 2 activities. one activity questions an external db through a web service
In my app I've got a class that i use to get data from
I've got an android app, with a super-class that contains a layout that should
I create a custom image view by extending ImageView that just draws some text
I've got an Outer activity which has a Body onto which you drag other

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.