What i want to achieve is populating a spinner with previously created openFileOutput files.
This is the code for creating the files:
save.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
FILENAME = filename.getText().toString();
COMMENTS = comments.getText().toString();
try {
FileOutputStream f = openFileOutput(FILENAME,
Context.MODE_PRIVATE);
f.write(COMMENTS.getBytes());
f.close();
Toast.makeText(getBaseContext(),
"Saved",
Toast.LENGTH_SHORT).show();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
So for example: I create these 3 files with the code above: File1 File2 File3
I want my spinner to look like this:
File1
File2
File3
The problem i'm having is that i have no clue to how this is done.
I google searched it, but unfortunately no results.
Can someone explain to me how to achieve this, preferably with sample code?
Thanks!