I'm trying to open a form based on the value of the Expense field being Null.
if in my app one of my list items, one of the expense items has a value of Null
i want it to open a certain form.
If it contains a value of "1" I want it to open a different form.
Can someone take a look at my code to se where I might be going wrong.
private void fillData() {
mItemsCursor = mDbHelper.fetchAllItems();
startManagingCursor(mItemsCursor);
String[] from = new String[]{DbAdapter.KEY_ITEM, DbAdapter.KEY_EXPENSE, DbAdapter.KEY_BUDGET,
DbAdapter.KEY_ACTUAL, DbAdapter.KEY_RESULTS};
int[] to = new int[]{R.id.text1, R.id.text2, R.id.text3, R.id.text4, R.id.text5};
SimpleCursorAdapter items =
new SimpleCursorAdapter(this, R.layout.budget_row, mItemsCursor, from, to);
setListAdapter(items);
}
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
super.onListItemClick(l, v, position, id);
if (DbAdapter.KEY_EXPENSE == null) {
Intent i = new Intent(this, Budget_Income.class);
i.putExtra(DbAdapter.KEY_ROWID, id);
startActivityForResult(i, ACTIVITY_EDIT);
}
else {
Intent a = new Intent(this, Budget_Expense.class);
a.putExtra(DbAdapter.KEY_ROWID, id);
startActivityForResult(a, ACTIVITY_EDIT);
}
}