This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hallo, I'm trying to read and write a file.
If any one haves experience in making a save game futures. I love to get any tips you have to give. I'm so green.
I made this and it is not working. I thing a mist something.
InputStream is = StartGame.ourView.getResources().openRawResource(R.raw.car);
OutputStream os = new FileOutputStream(file);
byte data = new byte [is.available()];
Variables.text3 = "Image Saved";
It seems to me that you use the path variable before you assign it a value. It isn't clear where the image would be saved when the path provided is null (it doesn't appear to cause a NullPointerException, but nor does it say what the location is). Try to put the assignment to path before you create the file.
Joined: Sep 29, 2011
Thanks. I switch the two lines and it worked.
Its a classic, what came first chicken or the egg?