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();
    }
  }
Beispiel #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();
    }
  }
  @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();
    }
  }