0

I want to add some set of text on Image after capturing from camera and add text left corner. Like below photo is example I have 25 photos of gridlayout,so need to capture image from camera and put text on that image and save it as file and need to send it to server. But didn't have idea to add the text on it... can somebody help me...

I try with Canvas and Paint but it doesn't help me much.

val bitmap = MediaStore.Images.Media.getBitmap(this.contentResolver, fileUri)
val mutableBitmap: Bitmap = bitmap.copy(Bitmap.Config.ARGB_8888, true)
val canvas = Canvas(mutableBitmap);
val paint = Paint();
paint.setColor(Color.WHITE);
paint.setTextSize(10f);
canvas.drawText("Some Text here", 10f, 10f, paint);
imgProfile.draw(canvas)

enter image description here

Prashant Arvind
  • 2,139
  • 20
  • 27
  • Those are multiple `TextView`s. The `ImageView` is given with `match_parent` `width` and `height`. Then `TextView`s are placed on the bottom left of the screen. Hope this helps. Feel free to ask for clarifications... – Vishnu Jul 24 '20 at 06:38
  • Thanks @Vishnu for quick resposne, I need so save as file and send it to sever. There is not a single image there. there are about 25 photo in single screen with gridlayout. So after taking a photo I need to put text on image and send it to server. – Prashant Arvind Jul 24 '20 at 06:47
  • Doesn't the method I suggested work? – Vishnu Jul 24 '20 at 06:53
  • Its right for a single image on a screen. But not for me I have 25 photos on same screen... if I go with your suggestion then How may I save that image as file and send it server... – Prashant Arvind Jul 24 '20 at 06:58
  • Then create a layout as I suggested (Like we do custom layouts for `RecyclerView`) and an adapter for `GridLayout` with that layout as the single item. Does this work? – Vishnu Jul 24 '20 at 07:01
  • create your layout in that way using relative layout and take screenshot of that using https://stackoverflow.com/a/5651242/3995126 – kelvin Jul 24 '20 at 07:03

0 Answers0