Created
October 23, 2012 11:46
-
-
Save misto/3938337 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static final int SCAN_QR_CODE_REQUEST_CODE = 0; | |
@Override | |
public boolean onCreateOptionsMenu(Menu menu) { | |
MenuItem menuItem = menu.add("Log"); | |
menuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() { | |
@Override | |
public boolean onMenuItemClick(MenuItem item) { | |
Intent intent = new Intent("com.google.zxing.client.android.SCAN"); | |
intent.putExtra("SCAN_MODE", "QR_CODE_MODE"); | |
startActivityForResult(intent, SCAN_QR_CODE_REQUEST_CODE); | |
return false; | |
} | |
}); | |
return super.onCreateOptionsMenu(menu); | |
} | |
@Override | |
public void onActivityResult(int requestCode, int resultCode, Intent intent) { | |
if (requestCode == SCAN_QR_CODE_REQUEST_CODE) { | |
if (resultCode == RESULT_OK) { | |
String logMsg = intent.getStringExtra("SCAN_RESULT"); | |
// Weiterverarbeitung.. | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment