Reputation: 335
I want to create an image (e.g coupons) in my applications by giving the specifications in the edit text.Let suppose i have 3 edit texts for name,color,content respectively.when i fill these details and click on submit button, A image should generate containing all the specifications that i have giving in the edit text so that user can change it any time and generate the desired image.
how can i achieve this?
Upvotes: 0
Views: 208
Reputation: 234847
You can create a Bitmap of whatever size you want for your coupons:
Bitmap coupon = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
Then you create a Canvas for drawing into the Bitmap:
Canvas canvas = new Canvas(coupon);
Draw your coupon using canvas
with the same calls as you would when drawing to the screen. Finally, you can display the Bitmap on the screen either in a custom view's onDraw
method or by creating an ImageView and calling it's setImageBitmap
method with your coupon bitmap.
Upvotes: 3