-1

Here points, streak and level are dynamic I want to share this whole image with the dynamic text of points, streak and level with implicit intent. How can I do this please help me out?

enter image description here

2 Answers2

0

By implicit intents to you mean intent to open another app ? If you want to share the whole image you have to first create a snapshot

Bruno
  • 3,872
  • 4
  • 20
  • 37
0

I worked on same type of functionality

First you have to make single picture. For this purpose you can use Sticker View Library https://github.com/wuapnjie/StickerView

You can add many views as stickers on Sticker View and then you can call method

 stickview.createbitmap();

This will create bitmap for you and then you can send that bitmap It's hardwork , but i am sure this method will work for you

OR you can try this to create bitmap from view

   public static Bitmap getBitmapFromView(View view) {
view.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
Bitmap bitmap = Bitmap.createBitmap(view.getMeasuredWidth(), view.getMeasuredHeight(),
        Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight());
view.draw(canvas);
return bitmap;
  }
Muhammad Hassaan
  • 874
  • 6
  • 18
  • this is the single picture only but the thing is points, level and streak is dynamic – Divyank Vijayvergiya Aug 01 '18 at 11:48
  • you can acheive functionality , you can add textview as sticker and then you can also update or replace sticker , the sticker can be image, drawable or textview – Muhammad Hassaan Aug 01 '18 at 11:50
  • this is the easiest way i told you to merge views in single image , other way is using OpenCv library which can be difficult – Muhammad Hassaan Aug 01 '18 at 11:50
  • i worked on image editing app, and i watermarked text, similily images on image view by using this way – Muhammad Hassaan Aug 01 '18 at 11:51
  • so I have to define all the views inside stickview? – Divyank Vijayvergiya Aug 01 '18 at 11:52
  • yes , you can use sticker view as any other view container , its up to you how to control views position inside sticker view, read library documentation – Muhammad Hassaan Aug 01 '18 at 11:55
  • try this first and let me know result , public static Bitmap getBitmapFromView(View view) { view.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED); Bitmap bitmap = Bitmap.createBitmap(view.getMeasuredWidth(), view.getMeasuredHeight(), Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(bitmap); view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight()); view.draw(canvas); return bitmap; } – Muhammad Hassaan Aug 01 '18 at 11:58
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/177187/discussion-between-muhammad-hassaan-and-divyank-vijayvergiya). – Muhammad Hassaan Aug 01 '18 at 12:00