Skip to content

Instantly share code, notes, and snippets.

@arch-jslin
Created February 23, 2011 17:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arch-jslin/840794 to your computer and use it in GitHub Desktop.
Save arch-jslin/840794 to your computer and use it in GitHub Desktop.
saveGameData.java
//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