- @Override
- public boolean onOptionsItemSelected(MenuItem item)
- {
- switch(item.getItemId())
- {
- case R.id.qrcode_scan:
- try
- {
- Intent intent = new Intent("com.google.zxing.client.android.SCAN");
- intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
- this.startActivityForResult(intent, QRCODE_RESULT);
- return true;
- }
- catch(Exception e)
- {
- Toast.makeText(this, "呼叫條碼掃描器失敗,請先確定是否正確安裝!", Toast.LENGTH_SHORT).show();
- }
- break;
- }
- return false;
- }
複製代碼 |