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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:28:55+00:00 2026-06-11T09:28:55+00:00

The Class definition private class classSerial implements Serializable { private static final long serialVersionUID

  • 0

The Class definition

private class classSerial implements Serializable {
    private static final long serialVersionUID = 1L;
    String vString;
    boolean vBool;
    long vLong;
    int vInt;

    classSerial(){
     //initialize members;
    }
}

I still get the error :

Caused by: java.io.NotSerializableException: com.example.....

When I try to do a writeObject (using an object of FileOutputStream) on an object of classSerial.


From what I have read, the data types that I have used, String,boolen,long,int are Serializable. So, I do not need to implement any methods.

What is it that I am missing here?


LOGCAT

09-16 19:58:26.170: W/dalvikvm(4278): threadid=1: thread exiting with uncaught exception (group=0x40018560)
09-16 19:58:26.201: E/AndroidRuntime(4278): FATAL EXCEPTION: main
09-16 19:58:26.201: E/AndroidRuntime(4278): java.lang.IllegalStateException: Could not execute method of the activity
09-16 19:58:26.201: E/AndroidRuntime(4278):     at android.view.View$1.onClick(View.java:2165)
09-16 19:58:26.201: E/AndroidRuntime(4278):     at android.view.View.performClick(View.java:2506)
09-16 19:58:26.201: E/AndroidRuntime(4278):     at android.view.View$PerformClick.run(View.java:9112)
09-16 19:58:26.201: E/AndroidRuntime(4278):     at android.os.Handler.handleCallback(Handler.java:587)
09-16 19:58:26.201: E/AndroidRuntime(4278):     at android.os.Handler.dispatchMessage(Handler.java:92)
09-16 19:58:26.201: E/AndroidRuntime(4278):     at android.os.Looper.loop(Looper.java:130)
09-16 19:58:26.201: E/AndroidRuntime(4278):     at android.app.ActivityThread.main(ActivityThread.java:3835)
09-16 19:58:26.201: E/AndroidRuntime(4278):     at java.lang.reflect.Method.invokeNative(Native Method)
09-16 19:58:26.201: E/AndroidRuntime(4278):     at java.lang.reflect.Method.invoke(Method.java:507)
09-16 19:58:26.201: E/AndroidRuntime(4278):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:864)
09-16 19:58:26.201: E/AndroidRuntime(4278):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:622)
09-16 19:58:26.201: E/AndroidRuntime(4278):     at dalvik.system.NativeStart.main(Native Method)
09-16 19:58:26.201: E/AndroidRuntime(4278): Caused by: java.lang.reflect.InvocationTargetException
09-16 19:58:26.201: E/AndroidRuntime(4278):     at java.lang.reflect.Method.invokeNative(Native Method)
09-16 19:58:26.201: E/AndroidRuntime(4278):     at java.lang.reflect.Method.invoke(Method.java:507)
09-16 19:58:26.201: E/AndroidRuntime(4278):     at android.view.View$1.onClick(View.java:2160)
09-16 19:58:26.201: E/AndroidRuntime(4278):     ... 11 more
09-16 19:58:26.201: E/AndroidRuntime(4278): Caused by: java.io.NotSerializableException: com.example.testing.serialActivity
09-16 19:58:26.201: E/AndroidRuntime(4278):     at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1535)
09-16 19:58:26.201: E/AndroidRuntime(4278):     at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1847)
09-16 19:58:26.201: E/AndroidRuntime(4278):     at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1689)
09-16 19:58:26.201: E/AndroidRuntime(4278):     at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1653)
09-16 19:58:26.201: E/AndroidRuntime(4278):     at java.io.ObjectOutputStream.writeFieldValues(ObjectOutputStream.java:1143)
09-16 19:58:26.201: E/AndroidRuntime(4278):     at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:413)
09-16 19:58:26.201: E/AndroidRuntime(4278):     at java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1241)
09-16 19:58:26.201: E/AndroidRuntime(4278):     at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1575)
09-16 19:58:26.201: E/AndroidRuntime(4278):     at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1847)
09-16 19:58:26.201: E/AndroidRuntime(4278):     at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1689)
09-16 19:58:26.201: E/AndroidRuntime(4278):     at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1653)
09-16 19:58:26.201: E/AndroidRuntime(4278):     at com.example.testing.serialActivity.login(login_activity.java:277)
09-16 19:58:26.201: E/AndroidRuntime(4278):     at com.example.testing.serialtest.login(serialtest.java:34)
09-16 19:58:26.201: E/AndroidRuntime(4278):     ... 14 more
  • 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-11T09:28:56+00:00Added an answer on June 11, 2026 at 9:28 am

    The problem is likely to be that you have a inner class. i.e. its not static so it have a reference to the outer class which is not Serializable. This is why the check is there, to avoid serializing something you didn’t intent to.

    You will notice in the stack trace the class its complaining about is another class.

    NotSerializableException: com.example.testingserialActivity
    

    Try making the class

    private static class ClassSerial implement Serializable
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I've an Employee class with below definition: class Employee { private final String
ItemsByGuid definition: private Dictionary<string, Channel> ItemsByGuid = new Dictionary<string, Channel>(); i have a class:
My program has the following class definition: public sealed class Subscriber { private subscription;
as for the definition of Person: public class Person { private int id; private
Given a simple C# class definition like: [System.Windows.Markup.ContentProperty(PropertyOne)] public class SimpleBase { public string
there. I have the foloowing class definition: [Serializable] public enum FilterType { [XmlEnum(1)] Text
I recently removed a private specified from a class definition because it was at
I need to create a static object inside a class definition. It is possible
Here's the code : public class EmployeeTest { public static void main(String args[]){ //System.out.println(hello
See the two ways of class definition: //definition: 1 public class MyClass{ private MyObject

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.