Guest User

Untitled

a guest
Nov 21st, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. protected void onCreate(Bundle savedInstanceState) {
  2. super.onCreate(savedInstanceState);
  3. setContentView(R.layout.activity_camera);
  4. tvqrresult = (TextView) findViewById(R.id.tvqrresult);
  5. mcamera = (Button) findViewById(R.id.btnopencamera);
  6. mcamera.setOnClickListener(new View.OnClickListener() {
  7. @Override
  8. public void onClick(View view) {
  9.  
  10.  
  11. Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
  12. startActivityForResult(cameraIntent, CAMERA_PIC_REQUEST);
  13. }
  14. });
  15.  
  16. if (qrcoderesult == true)
  17. {
  18. Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
  19. startActivityForResult(cameraIntent, CAMERA_PIC_REQUEST);
  20. }
  21. }
  22.  
  23. @Override
  24. protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  25. if( requestCode == CAMERA_PIC_REQUEST)
  26. {
  27. // data.getExtras()
  28. Bitmap thumbnail = (Bitmap) data.getExtras().get("data");
  29. ImageView image =(ImageView) findViewById(R.id.PhotoCaptured);
  30. image.setImageBitmap(thumbnail);
  31. Bitmap bitmap = image.getDrawingCache();
  32.  
  33. //initializeTimerForDialog(convertBitmap(thumbnail).toString());
  34.  
  35. // Qrreaderinimage(thumbnail);
  36. }
  37. else
  38. {
  39. Toast.makeText(Camera.this, "Picture NOt taken", Toast.LENGTH_LONG);
  40. }
  41. super.onActivityResult(requestCode, resultCode, data);
  42. }
Add Comment
Please, Sign In to add comment