How to turn the picture while keeping it in Android



  • I'm putting the camera on the picture right, I'm doing the photo and I'm sending it to the right Activity.

    public void takePicture(View view) {
        camera.takePicture(null, null, new Camera.PictureCallback() {
            @Override
            public void onPictureTaken(byte[] data, Camera camera) {
    
            Intent intent = new Intent(context, AcceptNotAccept.class);
            intent.putExtra("picture", data);
            startActivity(intent);
    

    }

    I'll take it.

    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_accept_not_accept);

    Bundle extras = getIntent().getExtras();
    byte[] byteArray = extras.getByteArray("picture");
    bitmap = BitmapFactory.decodeByteArray(byteArray, 0, byteArray.length);
    
    ((ImageView) findViewById(R.id.ivForAcceptPicture)).setImageBitmap(bitmap);
    

    }

    Exhibition to go 90 degrees left... I've been digging around for two hours... Tell me who knows how to decide.



  • Matrix matrix = new Matrix();
    matrix.postRotate(90);
    bitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
    



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2