예제 #1
0
  private void handleResult(IntentResult scanResult) {
    boolean lb_salida = true;
    if (scanResult != null) {

      updateUITextViews(scanResult.getContents(), scanResult.getFormatName());

    } else {
      Toast.makeText(this, "No se ha leído nada :(", Toast.LENGTH_SHORT).show();
    }
  }
예제 #2
0
 @Override
 public void onActivityResult(int requestCode, int resultCode, Intent data) {
   IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
   SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
   if (scanResult == null || scanResult.getContents() == null) {
     return;
   }
   if (scanResult.getFormatName().equals("CODE_128")) {
     Log.d(TAG, "Setting serial number to: " + scanResult.getContents());
     prefs.edit().putString("share_key", scanResult.getContents()).apply();
     returnToHome();
   }
 }
  public void onActivityResult(int requestCode, int resultCode, Intent intent) {
    // get scan result
    IntentResult getResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);

    if (getResult != null) {
      String scanContent = getResult.getContents();
      String scanFormat = getResult.getFormatName();

      formatTxt.setText(String.format("FORMAT: %1$s", scanFormat));
      contentTxt.setText(String.format("CONTENT: %1$s", scanContent));
    } else {
      Toast.makeText(this, "No data!", Toast.LENGTH_LONG).show();
    }
  }
예제 #4
0
  @Override
  protected void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    final IntentResult scanningResult =
        IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
    if ((scanningResult != null)
        && ScanningBarCodeUtil.BAR_CODE_EAN_13.equals(scanningResult.getFormatName())) {
      final String barCode = scanningResult.getContents();
      final Intent browseItemsIntent = new Intent(this, BrowseItemsActivity.class);
      browseItemsIntent.putExtra(BAR_CODE, barCode);

      startActivity(browseItemsIntent);
    } else {
      Toast.makeText(this, getString(R.string.no_scan_data), Toast.LENGTH_LONG).show();
    }
  }