Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 8th, 2012  |  syntax: None  |  size: 1.16 KB  |  hits: 9  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How to scan QRCode in android
  2. try {
  3.                             Intent intent = new Intent(
  4.                                     "com.google.zxing.client.android.SCAN");
  5.                             intent.putExtra("SCAN_MODE", "QR_CODE_MODE"); // "PRODUCT_MODE for bar codes
  6.  
  7.                             startActivityForResult(intent, 0);
  8.                         } catch (Exception e) {
  9.  
  10.                             Uri marketUri = Uri
  11.                                     .parse("market://details?id=com.google.zxing.client.android");
  12.                             Intent marketIntent = new Intent(Intent.ACTION_VIEW,
  13.                                     marketUri);
  14.                             startActivity(marketIntent);
  15.  
  16.  
  17.                    }
  18.        
  19. @Override
  20.         protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  21.             // TODO Auto-generated method stub
  22.             super.onActivityResult(requestCode, resultCode, data);
  23.             if (requestCode == 0) {
  24.                 if (resultCode == RESULT_OK) {
  25.                     String contents = data.getStringExtra("SCAN_RESULT");
  26.     }
  27. if(resultCode == RESULT_CANCELLED){
  28. //handle cancel
  29. }
  30. }