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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:31:46+00:00 2026-05-28T16:31:46+00:00

Java Exception: http://hastebin.com/yiwecefifi.avrasm I have an object, that I call Category, that my fragment

  • 0

Java Exception: http://hastebin.com/yiwecefifi.avrasm

I have an object, that I call Category, that my fragment (A CategoryFragment [extending ListFragment]) needs to have access to in order to fill the ListView with content.

Normally, this works fine. The app starts, the categories are created, and the lists show up (As I have several of these in a ViewPager).

However, after pressing Home and staying away for a bit, re-entering the app will cause a crash. Before I created a constructor with a parameter, it would give me a NullPointerException to the category. Since then, I decided to give it a constructor with the category object, and now it fails in this manner.

So then, my question is one of two things:

  1. How do I force the instantiation of the fragment through my activity? or
  2. How do I make Android keep my object? I assume it’ll need to be serializable, but how do I keep it available when the Fragment is created again?

The manifest data for this activity is below:

<activity
    android:launchMode="singleInstance"
    android:name=".NewsActivity"
    android:configChanges="orientation|keyboardHidden|screenSize|screenLayout|uiMode"
    android:label="@string/shortcut_name"
    android:theme="@style/Theme.BgsuNews" >
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>
  • 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-28T16:31:47+00:00Added an answer on May 28, 2026 at 4:31 pm

    This link in the docs about saving activity state should be useful. Fragments also have the onSave/RestoreInstanceState() functions like activities. You would need to decide which class your Category object belongs to (the Activity or the Fragment), and save and restore your Category data via the Bundle passed to you in the onSave/RestoreInstanceState() functions of that class.

    For another way to store work in progress there’s this approach, which may or may not be useful in your case. (It’s what I do wherever possible, and onSaveInstanceState() works well for everything else.)

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

Sidebar

Related Questions

Exception in thread Thread-0 java.lang.NullPointerException at org.apache.http.impl.nio.reactor.AbstractIOReactor.closeActiveChannels(AbstractIOReactor.java:532) at org.apache.http.impl.nio.reactor.AbstractIOReactor.hardShutdown(AbstractIOReactor.java:564) at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor.doShutdown(AbstractMultiworkerIOReactor.java:411) at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor.execute(AbstractMultiworkerIOReactor.java:340) at
Just wonder how much cost to raise a java exception (or to call native
Is there a C# equivalent method to Java's Exception.printStackTrace() or do I have to
Is there some sort of exception in Java to catch an invalid Date object?
I'm trying to make modal frame in Java Applet such like shown here: http://www.java2s.com/Tutorial/Java/0240__Swing/Showthegivenframeasmodaltothespecifiedowner.htm
I want to call a C subroutine from Java. I'm using JNI. I have
Hi I am using the following code from this site: http://java.sun.com/developer/technicalArticles/ALT/Reflection/ But when I
I followed this tutorial http://www.ibm.com/developerworks/java/tutorials/j-jni/section2.html (C implementation) for implementing a simple example of JNI
I have java app that uses Axis to get data from web service. web
I have three programs, first does a selenium test import com.thoughtworks.selenium.*; import java.util.regex.Pattern; import

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.