53 lines
1.4 KiB
Java
53 lines
1.4 KiB
Java
package com.openwide.android;
|
|
|
|
import android.app.ListActivity;
|
|
import android.database.Cursor;
|
|
import android.os.Bundle;
|
|
import android.widget.SimpleCursorAdapter;
|
|
|
|
public class ListEntryActivity extends ListActivity {
|
|
DeliveryDbAdapter mDbHelper;
|
|
Long mDeliveryId;
|
|
@Override
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
super.onCreate(savedInstanceState);
|
|
setContentView(R.layout.entry_list);
|
|
Bundle extras = getIntent().getExtras();
|
|
mDeliveryId = extras != null ? extras.getLong(SelectDeliveryActivity.PARAM_DELIVERY_ID): null;
|
|
|
|
mDbHelper = new DeliveryDbAdapter(this);
|
|
mDbHelper.open();
|
|
fillData();
|
|
registerForContextMenu(getListView());
|
|
|
|
|
|
}
|
|
|
|
public void fillData() {
|
|
Cursor deliveryCursor = mDbHelper.fetchAllEntry(mDeliveryId);
|
|
|
|
startManagingCursor(deliveryCursor);
|
|
|
|
String[] from = new String[]{DeliveryDbAdapter.KEY_DELIVERY_ENTRY_NAME, DeliveryDbAdapter.KEY_DELIVERY_ENTRY_NUMBER, DeliveryDbAdapter.KEY_DELIVERY_ENTRY_DELIVERED };
|
|
|
|
int[] to = new int[]{R.id.name, R.id.number, R.id.delivered};
|
|
|
|
SimpleCursorAdapter notes =
|
|
new SimpleCursorAdapter(this, R.layout.entry_row, deliveryCursor, from, to);
|
|
setListAdapter(notes);
|
|
}
|
|
|
|
@Override
|
|
protected void onSaveInstanceState(Bundle outState) {
|
|
super.onSaveInstanceState(outState);
|
|
}
|
|
|
|
|
|
@Override
|
|
protected void onDestroy() {
|
|
mDbHelper.close();
|
|
super.onDestroy();
|
|
}
|
|
|
|
}
|