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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:51:07+00:00 2026-06-04T19:51:07+00:00

public class move implements Serializable { private static final long serialVersionUID = 6696031872468154516L; public

  • 0
public class move implements Serializable
{
    private static final long serialVersionUID = 6696031872468154516L;
    public move(int a,int b){
        x=a;
        y=b;
    }
    int x,y;
}

I send this by ObjectOutputStream – just using out.writeObject(params[0]);

When I see LogCat, it says :

06-02 16:09:48.750: W/System.err(6060): java.io.NotSerializableException: com.SWAP.AndTablet.MainActivity
06-02 16:09:48.750: W/System.err(6060):     at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1364)
06-02 16:09:48.750: W/System.err(6060):     at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1671)
06-02 16:09:48.750: W/System.err(6060):     at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1517)
06-02 16:09:48.750: W/System.err(6060):     at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1481)
06-02 16:09:48.750: W/System.err(6060):     at java.io.ObjectOutputStream.writeFieldValues(ObjectOutputStream.java:979)
06-02 16:09:48.750: W/System.err(6060):     at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:368)
06-02 16:09:48.750: W/System.err(6060):     at java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1074)
06-02 16:09:48.750: W/System.err(6060):     at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1404)
06-02 16:09:48.750: W/System.err(6060):     at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1671)
06-02 16:09:48.754: W/System.err(6060):     at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1517)
06-02 16:09:48.754: W/System.err(6060):     at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1481)
06-02 16:09:48.754: W/System.err(6060):     at com.SWAP.AndTablet.MainActivity$MouseMoveSendTask.doInBackground(MainActivity.java:59)
06-02 16:09:48.754: W/System.err(6060):     at com.SWAP.AndTablet.MainActivity$MouseMoveSendTask.doInBackground(MainActivity.java:1)
06-02 16:09:48.754: W/System.err(6060):     at android.os.AsyncTask$2.call(AsyncTask.java:264)
06-02 16:09:48.754: W/System.err(6060):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
06-02 16:09:48.754: W/System.err(6060):     at java.util.concurrent.FutureTask.run(FutureTask.java:137)
06-02 16:09:48.754: W/System.err(6060):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
06-02 16:09:48.757: W/System.err(6060):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
06-02 16:09:48.757: W/System.err(6060):     at java.lang.Thread.run(Thread.java:856)

Can anyone help me?

  • 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-04T19:51:08+00:00Added an answer on June 4, 2026 at 7:51 pm

    I suspect this is a nested class, which means there’s an implicit reference to the outer class, even if you don’t use it. So if your class is nested within MainActivity, you’ll end up trying to serialize the enclosing instance of MainActivity even though you don’t want to. MainActivity isn’t serializable (and almost certainly shouldn’t be) which is causing the error.

    You can get round this just by making it static:

    public static class Move implements Serializable {
        private final int x, y;
        private static final long serialVersionUID = 6696031872468154516L;
    
        public Move(int a,int b) {
            x = a;
            y = b;
        }
    }
    

    If it isn’t a nested class, then I suspect the problem doesn’t lie with the code you’ve shown us.

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

Sidebar

Related Questions

I have a class like: public class SomeClassImpl implements SomeClass { private static final
public class Ex7 { private int fld; private void meth(int val) { fld =
public class Arrys { private int[] nums; //Step 3 public Arrys (int arrySize) {
public class JFrameWithPanel extends JFrame implements ActionListener, ItemListener { int packageIndex; double price; double[]
There are number of problems with this code public class LineEx extends JFrame implements
public class TestBL { public static void AddFolder(string folderName) { using (var ts =
public class ToolPartGetLists : Microsoft.SharePoint.WebPartPages.WebPart, ICommunicationInterface { private bool _error = false; //......... protected
public class Order { static Customer cust = new Customer(); string sEmpty = ;
public class MySingletonClass { public MySingletonClass() { _mySingletonObj = Instance(); } public static MySingletonClass
Let's assume I have an annotated bean property setter like this: public class Foo

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.