/** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); SQLiteWrapper handle = SQLiteWrapper.getInstance(PreviousBarcodeSearchList.this); BarcodeItem[] barcodes = handle.getRecentlySearchedProducts(handle.getReadableDatabase(), MAX_DAYS_SINCE_SEARCH); Log.v("Count", "Count: " + barcodes.length); setListAdapter(new CustomImageListAdaptor(this, barcodes)); }
// @Override public void onClick(DialogInterface dialog, int which) { switch (which) { case DialogInterface.BUTTON_POSITIVE: SQLiteWrapper sqLiteWrapper = SQLiteWrapper.getInstance(PreviousBarcodeSearchList.this); sqLiteWrapper.insertCouponCode( sqLiteWrapper.getWritableDatabase(), selectedValue.getCoupon()); AlertDialog.Builder builder = new AlertDialog.Builder(PreviousBarcodeSearchList.this); builder .setMessage("Coupon added!") .setPositiveButton("Add More", alertBoxListener) .setNegativeButton("Return to Main Menu", alertBoxListener) .show(); break; case DialogInterface.BUTTON_NEGATIVE: break; } }