diff --git a/src/ryuslash/org/dvdroid/DVDroidActivity.java b/src/ryuslash/org/dvdroid/DVDroidActivity.java index 5a46286..613620c 100644 --- a/src/ryuslash/org/dvdroid/DVDroidActivity.java +++ b/src/ryuslash/org/dvdroid/DVDroidActivity.java @@ -15,6 +15,30 @@ public class DVDroidActivity extends ListActivity { private DVDDataSource datasource; + public void addDVD(View view) + { + Intent intent = new Intent(this, AddDVDActivity.class); + + datasource.close(); + startActivityForResult(intent, 1); + } + + @Override + protected void onActivityResult(int requestCode, + int resultCode, + Intent data) + { + super.onActivityResult(requestCode, resultCode, data); + datasource.open(); + + ArrayAdapter adapter = (ArrayAdapter)getListAdapter(); + List dvds = datasource.getWishlist(); + + adapter.clear(); + adapter.addAll(dvds); + adapter.notifyDataSetChanged(); + } + /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) @@ -34,21 +58,6 @@ public class DVDroidActivity extends ListActivity setListAdapter(adapter); } - public void addDVD(View view) - { - Intent intent = new Intent(this, AddDVDActivity.class); - - datasource.close(); - startActivityForResult(intent, 1); - } - - @Override - protected void onResume() - { - datasource.open(); - super.onResume(); - } - @Override protected void onPause() { @@ -57,18 +66,9 @@ public class DVDroidActivity extends ListActivity } @Override - protected void onActivityResult(int requestCode, - int resultCode, - Intent data) + protected void onResume() { - super.onActivityResult(requestCode, resultCode, data); datasource.open(); - - ArrayAdapter adapter = (ArrayAdapter)getListAdapter(); - List dvds = datasource.getWishlist(); - - adapter.clear(); - adapter.addAll(dvds); - adapter.notifyDataSetChanged(); + super.onResume(); } }