Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix bug

Signed-off-by: Simone <hello@simonewebdesign.it>
  • Loading branch information...
commit f0d18b8df2cf7bf6e85d96d69aa1cbfdf5de6c15 1 parent 86b4f99
@simonewebdesign authored
Showing with 3 additions and 4 deletions.
  1. +3 −4 src/com/example/todolist/MainActivity.java
View
7 src/com/example/todolist/MainActivity.java
@@ -166,8 +166,6 @@ public String readJSON() throws FileNotFoundException, IOException {
try {
FileInputStream fis = openFileInput(FILENAME);
- fis.read();
- fis.close();
byte[] buffer = new byte[1024];
/* Reads a single byte from this stream and returns it as an integer
@@ -175,9 +173,10 @@ public String readJSON() throws FileNotFoundException, IOException {
* has been reached. Blocks until one byte has been read, the end of
* the source stream is detected or an exception is thrown.
*/
- while ( (fis.read(buffer)) != -1 ) {
+ while ( fis.read(buffer) != -1 ) {
fileContent.append(new String(buffer));
- }
+ }
+ fis.close();
} catch (IOException e) {
// could be IOException or FileNotFoundException
Please sign in to comment.
Something went wrong with that request. Please try again.