title: Why doesn't my textview display anything?
body: <p>im  currently doing a app that has a barcode scanner. currently when i scanned the barcode it is suppose to display the format of the barcode and the contents also. but currently it doesnt display the format and contents after scanning.</p>
  
  <p>here is the code</p>
  
  <pre><code>public class ThreeFragment extends Fragment{
  
      public ThreeFragment() {
          // Required empty public constructor
      }
  
      Button scan_btn;
      EditText Edit_current;
      TextView formatTxt, contentTxt;
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle   savedInstanceState) {
          View view = inflater.inflate(R.layout.fragment_one, container, false);
          scan_btn = (Button) view.findViewById(R.id.scan_button);
          final Activity activity = getActivity();
          scan_btn.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                  IntentIntegrator integrator = new IntentIntegrator(activity);
                  integrator.setDesiredBarcodeFormats(IntentIntegrator.PRODUCT_CODE_TYPES);
                  integrator.setPrompt("Scan");
                  integrator.setCameraId(0);
                  integrator.setBeepEnabled(false);
                  integrator.setBarcodeImageEnabled(true);
                  integrator.initiateScan();
              }
          });
  
          return view;
      }
  
      @Override
      public void onActivityResult(int requestCode, int resultCode, Intent data) {
          IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
          if (result.getContents() != null) {
              if (result.getContents() != null){
                  String scanContent = result.getContents();
                  String scanFormat = result.getFormatName();
  
                  // display it on screen
                  formatTxt.setText("FORMAT: " + scanFormat);
                  contentTxt.setText("CONTENT: " + scanContent);
              } else {
                  Toast toast = Toast.makeText(getContext(),"No scan data received!", Toast.LENGTH_SHORT);
                  toast.show();
              }
          }
      }
  }
  </code></pre>
  
  <p>my xml</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent" &gt;
      &lt;Button android:id="@+id/scan_button"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_centerHorizontal="true"
          android:text="@string/scan" /&gt;
  
      &lt;TextView
          android:id="@+id/scanFormat"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:textIsSelectable="true"
          android:layout_centerHorizontal="true"
          android:layout_below="@id/scan_button" /&gt;
      &lt;TextView
          android:id="@+id/scanContent"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:textIsSelectable="true"
          android:layout_centerHorizontal="true"
          android:layout_below="@id/scanFormat" /&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>i have edit the code to this </p>
  
  <pre><code>@Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle   savedInstanceState) {
      View view = inflater.inflate(R.layout.fragment_one, container, false);
      scan_btn = (Button) view.findViewById(R.id.scan_button);
      formatTxt = (TextView) view.findViewById(R.id.scanFormat);
      contentTxt = (TextView) view.findViewById(R.id.scanContent);
      final Activity activity = getActivity();
      scan_btn.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              IntentIntegrator integrator = new IntentIntegrator(activity);
              integrator.setDesiredBarcodeFormats(IntentIntegrator.PRODUCT_CODE_TYPES);
              integrator.setPrompt("Scan");
              integrator.setCameraId(0);
              integrator.setBeepEnabled(false);
              integrator.setBarcodeImageEnabled(true);
              integrator.initiateScan();
          }
      });
      return view;
  }
  
  @Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
      IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
      if (result.getContents() != null) {
          if (result.getContents() == null){
              Toast toast = Toast.makeText(getContext(),"No scan data received!", Toast.LENGTH_SHORT);
              toast.show();
  
  
      }else{
  
              String scanContent = result.getContents();
              String scanFormat = result.getFormatName();
  
              // display it on screen
              formatTxt.setText("FORMAT: " + scanFormat);
              contentTxt.setText("CONTENT: " + scanContent);
      }
  }
  }}
  </code></pre>
  
  <p>still cant display the  format and contents</p>