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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:25:24+00:00 2026-06-17T12:25:24+00:00

When I attempt to save my android game (played via Android simulator on my

  • 0

When I attempt to save my android game (played via Android simulator on my Windows laptop), I get a FileNotFoundException. I have spent hours trying different things, but remain perplexed as the code works perfectly on my previous version not for Android.

FileOutputStream saveStream;
ObjectOutputStream savePlayerObject = null;
String destinationFile = player1.getName() + ".txt";

try
{
   saveStream = new FileOutputStream(destinationFile);    
   savePlayerObject = new ObjectOutputStream(saveStream);   
   savePlayerObject.writeObject(player1);
}

catch(FileNotFoundException ex)
{
   Toast toast = Toast.makeText(getApplicationContext(), "Save Failed", Toast.LENGTH_LONG);
   toast.show();
}


catch(IOException ex)
{
   Toast toast = Toast.makeText(getApplicationContext(), "Save Failed", Toast.LENGTH_LONG);
   toast.show();
}


finally
{
   try
   {
      if(savePlayerObject !=null)
      {
         savePlayerObject.flush();    
         savePlayerObject.close();   
         Toast toast = Toast.makeText(getApplicationContext(), "Thank-You For Playing, See You Soon", Toast.LENGTH_LONG);
         toast.show();   
         System.exit(0);   
      }
   }

   catch(IOException ex)
   {
      Toast toast = Toast.makeText(getApplicationContext(), "Save Failed", Toast.LENGTH_LONG);
      toast.show();
   }
}
  • 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-17T12:25:25+00:00Added an answer on June 17, 2026 at 12:25 pm

    It means that the program couldn’t create the file at the specified location.

    String destinationFile = player1.getName() + ".txt";
    

    The file will be created in the current working directory. This is usually not what you want. You need to think about where exactly the file should go, then specify the absolute path.

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

Sidebar

Related Questions

I have a Flash game that I'm trying to save the state of when
I get this error when I attempt to open a Visio document and save
First attempt to use this cool site - after searching for 2 hours: So
Problem: I have to save live video streams data which come as an RTP
I have a use case where the application will automatically attempt to retrieve a
I am trying to do a simple upload of a .csv file and save
It is save to terminate the services using taskkill when the attempt to stop
How do I start a transaction in a controller, then attempt to save multiple
I have an Android app with a listview that updates the listview when the
I have been trying for the past day or so to create a file

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.