raman
raman

Reputation: 335

How to create an image by giving the specifications

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

Answers (1)

Ted Hopp
Ted Hopp

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

Related Questions