0

Hi I was wondering if I could get some assistance with how to achieve the same layout of this screen:

Target Image

So, when I use this code :

 send.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            Canvas canvas = new Canvas(bitmap);
            TextView1.setDrawingCacheEnabled(true);
            TextView2.setDrawingCacheEnabled(true);
            TextViewInfo1.setDrawingCacheEnabled(true);
            TextViewInfo2.setDrawingCacheEnabled(true);

            canvas.drawBitmap(TextViewInfo1.getDrawingCache(), 0, 100, null);
            canvas.drawBitmap(TextViewInfo2.getDrawingCache(), 0, 100, null);
            canvas.drawBitmap(TextView1.getDrawingCache(), 50, 200, null);
            canvas.drawBitmap(TextView2.getDrawingCache(), 500, 200, null);
            picFrame.setImageBitmap(bitmap);

I would like to have the same layout only this will print it onto the image. Here is my attempt as you can see is well off:

Attempt

Can someone help!

EDIT WHAT I AM TRYING TO ACHIEVE:

I Have built an activity and xml as seen in Target Image. The purpose of this is that the user enters the detail work order number and the image number. This data is then stored in the textviews above the image. The business would like to save the textviews along the top WITH the image as one file. Almost as if the textviews are layered at the top of the image. Although, to send this it must be a file such as bitmap.

  • Why do you need to use the Canvas to achieve that? Just use the Android components and use an xml file as it's gonna be easier. If you don't know how to proceed have a look at a tutorial on how to implement a basic UI on Android – Eselfar Jun 05 '18 at 15:23
  • I have looked everywhere looking for how to achieve this. Do you have a suggestion? – AndroidBeginner2018 Jun 05 '18 at 15:24
  • I've updated my comment above – Eselfar Jun 05 '18 at 15:25
  • @Eselfar no I am aware of xml and all that. I have the xml file already done but it is separate textviews at top then image below. I would like to combine these into an image so it can be sent to a destination – AndroidBeginner2018 Jun 05 '18 at 15:26
  • I don't understand what you try to achieve. If you want to build an UI just have a look at the [official documentation](https://developer.android.com/training/basics/firstapp/building-ui) otherwise you need to be more specific when asking your question – Eselfar Jun 05 '18 at 15:29
  • Have a look at my edit above I will explain it clearer. There you go @Eselfar is that any clearer? – AndroidBeginner2018 Jun 05 '18 at 15:30
  • You need to clarify the requirements with the business as it seems there is a misunderstanding. What you're trying to do is to manually create a screenshot and I'm pretty sure this is not what they want – Eselfar Jun 05 '18 at 15:40
  • And even if it is, there are easier ways to do that – Eselfar Jun 05 '18 at 15:42
  • Yes precisely to create a screenshot is what im looking and this has been clarified! any ideas?# – AndroidBeginner2018 Jun 05 '18 at 15:43
  • however, the screenshot must only be the image and the textviews – AndroidBeginner2018 Jun 05 '18 at 15:43
  • https://stackoverflow.com/a/4618030/1827254 – Eselfar Jun 05 '18 at 15:45
  • But I still think this is not what is expected (as it doesn't make any sense) – Eselfar Jun 05 '18 at 15:46
  • mine isn't returning null. THE BUSINESS NEED IMAGES SAVED WITH TEXT ABOVE THEM TO DESCRIBE THE IMAGE. IN ORDER TO SAVE THIS AS ONE FILE I NEED THE TEXTVIEWS TO BE MERGED INTO THE IMAGE – AndroidBeginner2018 Jun 05 '18 at 15:49
  • Dude, you can't shout at people when they try to help you. Stay calm and polite. There are a lot of tutorials on how to achieve what you want. Have a look around, make some tries and then come back if you still have an issue. – Eselfar Jun 05 '18 at 15:57

0 Answers0