Take the 2-minute tour ×

i know that there are similar topics to mine but non of them helps me to deal with my situation.

I have a class which contains an inner serialized non-static class in it. The crash is happening when I'm pressing on the device "home" key(and app is going to the background)

This is my code

public class pageParam implements Serializable {

    private static final long serialVersionUID = 7793437011565026799L;

    public OnCloseListener onCloseListener;
    public long userId;
    public boolean hasName;
    public int age;

    public pageParam(OnCloseListener onCloseListener, long userId,
            boolean userId, int age) {
        this.onCloseListener = onCloseListener;
        this.userId = userId;
        this.hasName = hasName;
        this.age = age;


public abstract class OnCloseListener implements Serializable {

            private static final long serialVersionUID = -143252315312L;

    public abstract void onCloseListener();

please notice that OnCloseListener is abstract and I have the possibility to add serialVersionUID in the implementation of OnCloseListener(with or without doing it, it fails)


this is the implementation of OnCloseListener():

OnCloseListener OnCloseListener = new OnCloseListener() {

    private static final long serialVersionUID = -8848214522109319925L;

    public void OnCloseListener() {

as you can see, it has also serial key.


Even after I change OnCloseListener to be regular class (not abstract) I still got this exception error.

public class OnCloseListener implements Serializable {

    private static final long serialVersionUID = 2718040340149001112L;

    public void OnClose() {

Maybe it got to do with the code inside OnClose()? Im doing there some operations on the upper class.

share|improve this question
can you post the concrete implementation of onCloseListener you are using ? (which i think (not sure) must also implement Serializable explicitely (don't remember why, though)) –  njzk2 Jan 30 '13 at 13:15
I think it would do to remove abstract from the declaration of OnCloseListener; what is it supposed to do? I don't think abstract objects can successfully be serialized. –  Class Stacker Jan 30 '13 at 13:19
add comment

Your Answer



Browse other questions tagged or ask your own question.