public void run() {
Looper.prepare();
mHandler = new Handler() {
+ @Override
public void handleMessage(Message message) {
switch (message.what) {
case R.id.save:
private void save(byte[] data, int width, int height) {
int framingWidth = mFramingRect.width();
int framingHeight = mFramingRect.height();
- assert (framingWidth <= width);
- assert (framingHeight <= height);
+ if (framingWidth > width || framingHeight > height) {
+ throw new IllegalArgumentException();
+ }
int leftOffset = mFramingRect.left;
int topOffset = mFramingRect.top;
message.sendToTarget();
}
- private OutputStream getNewPhotoOutputStream() {
+ private static OutputStream getNewPhotoOutputStream() {
File sdcard = new File("/sdcard");
if (sdcard.exists()) {
File barcodes = new File(sdcard, "barcodes");