Reputation: 1138
I am creating an application in which i have used a method which takes imageView's object as its parameter,but from my code I am getting a canvas object.
So is there any way to convert that canvas object to imageview's object.
Upvotes: 0
Views: 379
Reputation: 16043
So is there any way to convert that canvas object to imageview's object.
You could convert a canvas to a Bitmap
:
Bitmap bitmap = Bitmap.createBitmap((int)width, (int)height, Config.RGB_565));
canvas.setBitmap(bitmap);
And then use that bitmap to be displayed by an ImageView
:
imageView.setImageBitmap(bitmap);
Upvotes: 1