diff --git a/src/ryuslash/org/dvdroid/AddDVDActivity.java b/src/ryuslash/org/dvdroid/AddDVDActivity.java index d25affd..f5244c3 100644 --- a/src/ryuslash/org/dvdroid/AddDVDActivity.java +++ b/src/ryuslash/org/dvdroid/AddDVDActivity.java @@ -14,16 +14,6 @@ public class AddDVDActivity extends Activity { private DVDDataSource datasource; - @Override - public void onCreate(Bundle savedInstanceState) - { - super.onCreate(savedInstanceState); - setContentView(R.layout.add); - - datasource = new DVDDataSource(this); - datasource.open(); - } - public void createDVD() { EditText name_entry = (EditText)findViewById(R.id.name_entry); @@ -38,24 +28,13 @@ public class AddDVDActivity extends Activity } @Override - protected void onResume() + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.add); + + datasource = new DVDDataSource(this); datasource.open(); - super.onResume(); - } - - @Override - protected void onPause() - { - datasource.close(); - super.onPause(); - } - - @Override - protected void onDestroy() - { - datasource.close(); - super.onDestroy(); } @Override @@ -66,6 +45,13 @@ public class AddDVDActivity extends Activity return true; } + @Override + protected void onDestroy() + { + datasource.close(); + super.onDestroy(); + } + @Override public boolean onOptionsItemSelected(MenuItem item) { @@ -78,4 +64,18 @@ public class AddDVDActivity extends Activity return false; } + + @Override + protected void onPause() + { + datasource.close(); + super.onPause(); + } + + @Override + protected void onResume() + { + datasource.open(); + super.onResume(); + } }