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;
|
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. */
|
/** Called when the activity is first created. */
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState)
|
public void onCreate(Bundle savedInstanceState)
|
||||||
|
@ -34,21 +58,6 @@ public class DVDroidActivity extends ListActivity
|
||||||
setListAdapter(adapter);
|
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
|
@Override
|
||||||
protected void onPause()
|
protected void onPause()
|
||||||
{
|
{
|
||||||
|
@ -57,18 +66,9 @@ public class DVDroidActivity extends ListActivity
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onActivityResult(int requestCode,
|
protected void onResume()
|
||||||
int resultCode,
|
|
||||||
Intent data)
|
|
||||||
{
|
{
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
|
||||||
datasource.open();
|
datasource.open();
|
||||||
|
super.onResume();
|
||||||
ArrayAdapter<DVD> adapter = (ArrayAdapter<DVD>)getListAdapter();
|
|
||||||
List<DVD> dvds = datasource.getWishlist();
|
|
||||||
|
|
||||||
adapter.clear();
|
|
||||||
adapter.addAll(dvds);
|
|
||||||
adapter.notifyDataSetChanged();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue