mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
Added null checks for intent and action
This commit is contained in:
parent
55bbe9f7fb
commit
cf35e85024
|
@ -57,7 +57,18 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle icicle) {
|
public void onCreate(Bundle icicle) {
|
||||||
super.onCreate(icicle);
|
super.onCreate(icicle);
|
||||||
returnResult = getIntent().getAction().equals(SCAN_ACTION);
|
|
||||||
|
// returnResult should be true if activity was started using
|
||||||
|
// startActivityForResult() with SCAN_ACTION intent
|
||||||
|
returnResult = false;
|
||||||
|
|
||||||
|
Intent intent = getIntent();
|
||||||
|
if (intent != null) {
|
||||||
|
String action = intent.getAction();
|
||||||
|
if (action != null)
|
||||||
|
returnResult = action.equals(SCAN_ACTION);
|
||||||
|
}
|
||||||
|
|
||||||
Window window = getWindow();
|
Window window = getWindow();
|
||||||
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||||
setContentView(R.layout.capture);
|
setContentView(R.layout.capture);
|
||||||
|
|
Loading…
Reference in a new issue