Created
February 23, 2011 17:44
-
-
Save arch-jslin/840794 to your computer and use it in GitHub Desktop.
saveGameData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//igdshare 110220: code provided by hsufong | |
private int saveGameData(int fIndex){ | |
String saveFileName = "/data/data/com.mobile_sango/sangoSave"+fIndex+".bin"; | |
String description = setSaveDescription(); | |
FileOutputStream fosFile; | |
OutputStream fosDes; | |
File saveFile = new File(saveFileName); | |
if (!saveFile.exists()){ | |
try { | |
saveFile.createNewFile(); | |
} catch (IOException e1) { | |
e1.printStackTrace(); | |
return 0; | |
} | |
} | |
try { | |
fosFile = new FileOutputStream(saveFileName); | |
} catch (FileNotFoundException e1) { | |
// TODO Auto-generated catch block | |
e1.printStackTrace(); | |
return 0; | |
} | |
try { | |
ObjectOutputStream objOutputStream = new ObjectOutputStream(fosFile); | |
objOutputStream.writeObject(gd); | |
objOutputStream.close(); | |
} | |
catch(IOException e) { | |
e.printStackTrace(); | |
return 0; | |
} | |
return 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment