Commit 1ad35a68 authored by Mike Sheldon's avatar Mike Sheldon

Save a user's custom stations in Libre Droid

parent 0eccd118
......@@ -131,6 +131,7 @@ public class LibreDroid extends ListActivity {
while((station = stationReader.readLine()) != null) {
stations.add(station);
}
stationReader.close();
} catch (IOException ex) {
Log.d("libredroid", ex.getMessage());
}
......@@ -252,6 +253,16 @@ public class LibreDroid extends ListActivity {
public void addStation() {
final EditText stationEntry = (EditText) findViewById(R.id.stationEntry);
stations.add(0, stationEntry.getText().toString());
try{
FileOutputStream stationFile = openFileOutput("libredroid-custom-stations.conf", Context.MODE_PRIVATE);
for (String station : stations) {
stationFile.write(station.getBytes());
stationFile.write('\n');
}
stationFile.close();
} catch (IOException ex) {
Log.w("libredroid", ex.getMessage());
}
setListAdapter(new ArrayAdapter<String>(this, R.layout.list_item, stations));
this.prevPage();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment