Android Open Source - ZXingFragment Main Activity






From Project

Back to project page ZXingFragment.

License

The source code is released under:

Apache License

If you think the Android project ZXingFragment listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package de.klimek.zxingfragment;
/*from ww  w.j  av a  2s  .co  m*/
import android.app.Activity;
import android.app.FragmentManager;
import android.os.Bundle;
import android.widget.Toast;
import de.klimek.zxingfragment.Decoder.OnDecodedCallback;

public class MainActivity extends Activity implements OnDecodedCallback {

  private ZxingFragment mZxingFragment;

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    FragmentManager fragmentManager = getFragmentManager();
    mZxingFragment = (ZxingFragment) fragmentManager.findFragmentById(R.id.zxing_fragment);
    mZxingFragment.setOnDecodedCallback(this);
  }

  @Override
  protected void onResume() {
    mZxingFragment.startScanning();
    super.onResume();
  }
  
  @Override
  protected void onPause() {
    mZxingFragment.stopScanning();
    super.onPause();
  }
  
  @Override
  public void onDecoded(String decodedData) {
    Toast.makeText(this, decodedData, Toast.LENGTH_SHORT).show();
  }

}




Java Source Code List

de.klimek.zxingfragment.DecodeTask.java
de.klimek.zxingfragment.Decoder.java
de.klimek.zxingfragment.MainActivity.java
de.klimek.zxingfragment.Reticle.java
de.klimek.zxingfragment.ScannerView.java
de.klimek.zxingfragment.ZxingFragment.java