Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1.  
  2. findViewById(R.id.imageView_barcode).setOnClickListener(new OnClickListener() {
  3.  
  4. @Override
  5. public void onClick(View v) {
  6. startZXing();
  7. }
  8.  
  9. });
  10.  
  11.  
  12. private void startZXing() {
  13. Display display = getWindowManager().getDefaultDisplay();
  14. Point size = new Point();
  15. display.getSize(size);
  16. int width = size.x;
  17. int height = size.y;
  18. Intent intent = new Intent(this, CaptureActivity.class);
  19. intent.putExtra(Intents.Scan.WIDTH, width);
  20. intent.putExtra(Intents.Scan.HEIGHT, height);
  21. intent.putExtra(CaptureActivity.RETURN_RESULT, true);
  22. intent.setAction(Intents.Scan.ACTION);
  23. startActivityForResult(intent, 0);
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement