Now I know this may be a lot to ask for. But what I want to do is have the ability to save and open notes. Now currently I am able to save and load data on the phone to be opened the next time the app is open with this code here:
public class Notes extends Activity{
EditText savedText;
TextView dataResults;
public static String stringFolder = "SharedData";
SharedPreferences String;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.notes);
setupVariables();
String = getSharedPreferences(stringFolder, 0);
}
private void setupVariables(){
savedText = (EditText) findViewById(R.id.notes_text_view);
dataResults = (TextView) findViewById(R.id.notes_text_view);
}
public void saveNotes(View v)
{
String stringData = savedText.getText().toString();
SharedPreferences.Editor editor = String.edit();
editor.putString("SharedData", stringData);
editor.commit();
}
public void loadNotes(View v){
String = getSharedPreferences(stringFolder, 0);
String dataReturned = String.getString("SharedData", "Could not load");
dataResults.setText(dataReturned);
}
Now what I am hoping to do is every time the user clicks save it adds the text entered into an array under a name which the user can enter. When the user clicks load I want a list view to pop up showing all the names of the notes which have previously been saved and click on one to load it. i know this is a lot to ask but I'm wondering if anyone out there knows. Or there might be a very simple way to do this. I am very much a beginner to android.
Thanks, Reid