if (task1.toString().length() < 0) { task1.toString(); t1.setText(task1); } else { t1.setText(edit); }
The above makes no sense.
First, task1 is a string, so there is no need to call toString() to convert it to one.
Secondly, your conditional statement ( if ) checks if task1 less than zero .... think about it.
Thirdly, if it has an impossible length less than zero, you call toString() again (without a variable to get an impossible result less than zero), and then try setting the text of your t1 EditText .
The likelihood that reading a file does not work (possibly because you only save lines later in the onClick(...) method). Since your task strings will be null , if the file reading fails, then you need to test null before trying to use them.
In other words, you do this in your code ...
String task1 = null;
To fix the bit of code that I concluded at the beginning, use ...
if (task1 != null) { t1.setText(task1); } else { t1.setText(edit); }
... but most importantly, make sure there are lines in your files that you need to read.
source share