Permalink
Browse files

Move data restore on resume

Signed-off-by: simonewebdesign <hello@simonewebdesign.it>
  • Loading branch information...
1 parent dcfd7b9 commit ab922f8bd98f28100229c309dfacdc1368bfa8fc @simonewebdesign committed Mar 8, 2013
Showing with 10 additions and 10 deletions.
  1. +10 −10 src/com/example/todolist/MainActivity.java
@@ -56,15 +56,6 @@ protected void onCreate(Bundle savedInstanceState) {
// Bind the array adapter to the ListView
myListView.setAdapter(adapter);
- // Restore data from internal storage
- try {
- restoreDataFromJSON(readJSON());
- } catch (IOException e) {
-
- e.printStackTrace();
- }
- adapter.notifyDataSetChanged();
-
// Bind the event handler to the button
Button b = (Button) findViewById(R.id.myButton);
b.setOnClickListener(buttonListener);
@@ -111,6 +102,15 @@ protected void onPause() {
protected void onResume() {
super.onResume();
Log.v(TAG, "onResume called!");
+
+ // Restore data from internal storage
+ try {
+ restoreDataFromJSON(readJSON());
+ } catch (IOException e) {
+
+ e.printStackTrace();
+ }
+ adapter.notifyDataSetChanged();
}
@Override
@@ -227,7 +227,7 @@ public void saveData() {
}
@Override
- public void onDialogEditClick(DialogFragment dialog) {
+ public void onDialogEditClick(DialogFragment dialog) {
// TODO Auto-generated method stub
Log.v(TAG, "onDialogEditClick");
}

0 comments on commit ab922f8

Please sign in to comment.