Rearrange
This commit is contained in:
parent
9fc77db218
commit
1f3332e279
1 changed files with 26 additions and 26 deletions
|
@ -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<DVD> adapter = (ArrayAdapter<DVD>)getListAdapter();
|
||||
List<DVD> 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<DVD> adapter = (ArrayAdapter<DVD>)getListAdapter();
|
||||
List<DVD> dvds = datasource.getWishlist();
|
||||
|
||||
adapter.clear();
|
||||
adapter.addAll(dvds);
|
||||
adapter.notifyDataSetChanged();
|
||||
super.onResume();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue