1

My application has an ImageView in a relative layout and let the user add text to that image. It has been done by adding an EditText over the ImageView and then i call relativeLayout.getDrawingCache() to get the bitmap of the image with the text the user entered in it and save it to SD card. The problem is the resolution of saved image. When i try the app in a device with low resolution display, the saved bitmap will be low resolution too. for example, if the image is in 1028 px width but the device is only 480 px width, the resulting image will only be 480 px width. I want to get image with its real resolution to be saved to SD card. How to do it? Please, Help me.

Thank you.

DNY
  • 53
  • 5
  • It's only a ideea but you could try to extend the `ImageView` class and then override the `onDraw()` method and draw the text directly on canvas and then when you save the image you can write that canvas to a bitmap. – AlexMasca Mar 11 '14 at 09:04
  • Thanks for answering. That makes sense. But in this case, the text can be dinamically positioned by drag-and-drop on user finger touch. Any idea? Thank's again. :) – DNY Mar 11 '14 at 09:36
  • Hmm the text could be drawn in a rectangle and by overriding the `onTouch` from the image view i think you can recalculate the drawing position of the rectangle. – AlexMasca Mar 11 '14 at 09:42
  • That's Nice. I'll try it, My Friend. – DNY Mar 11 '14 at 10:05
  • I think i will just have to recalculate the position and also recalculate its size in the certain scale based on the comparison of actual image resolution and the displayed one. What do you think about it? – DNY Mar 11 '14 at 10:13
  • Yes you should recalculate based on the scale factor ;). – AlexMasca Mar 11 '14 at 11:24

0 Answers0