content: package com.tc2r.barcodereader;
  
  import android.content.Intent;
  import android.os.Bundle;
  import androidx.appcompat.app.AppCompatActivity;
  import android.view.View;
  import android.widget.Button;
  import android.widget.TextView;
  import android.widget.Toast;
  
  import com.google.zxing.intergration.android.IntentIntegrator;
  import com.google.zxing.intergration.android.IntentResult;
  
  /**
   * Created by Tc2r1 on Oct 2018.
   *
   * Description: Barcode reader allows you to take a picture of a barcode and translates
   * the data for you. *
   *
   */
  
  public class MainActivity extends AppCompatActivity implements View.OnClickListener {
  
      private Button scanBtn;
      private TextView formatTxt, contentTxt;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          scanBtn = findViewById(R.id.scan_button);
          formatTxt = findViewById(R.id.scan_format);
          contentTxt = findViewById(R.id.scan_content);
  
          scanBtn.setOnClickListener(this);
      }
  
      @Override
      public void onClick(View v) {
          if(v.getId()== R.id.scan_button){
              IntentIntegrator scanIntegrator = new IntentIntegrator(this);
              scanIntegrator.initiateScan();
          }
      }
  
      @Override
      protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
          IntentResult scanningResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
          if (scanningResult != null){
              String scanContent = scanningResult.getContents();
              String scanFormat = scanningResult.getFormatName();
              formatTxt.setText("FORMAT: " + scanFormat);
              contentTxt.setText("CONTENT: " + scanContent);
          }else{
              Toast toast = Toast.makeText(getApplicationContext(),"No scan data received!", Toast.LENGTH_SHORT);
              toast.show();
          }
      }
  }
  