title: Converting an entire layout to an image/bitmap
body: <p>I have been having an issue with this one line of code for a while and I would really apreciate it if any of you have ideaas about it.</p>
  <p>What I am trying to do is, save a specific layout( in this case a relative layout) as an image when a person hits a button. this action will transfer the image to the next activity. I'm pretty sure the actual act of transfering is not the problem. It's how I'm converting the layout to an image. below is the code with comments:</p>
  <p><strong>Here is whats on activity1</strong></p>
  <pre><code>        // here I found the button I wanted to use and made it:
          //   1. take us to next activity
          //   2. convert my relativelayout to and a bitmap and store it in a variable for transfer.
          
          findViewById&lt;Button&gt;(R.id.DoneButton).setOnClickListener{
              val intent = Intent(this, SaveAndNameActivity::class.java)
  
              //here is where I converted my relative layout to a bitmap. 
              val pictureStackCompleted =  findViewById&lt;RelativeLayout&gt;(R.id.pictureStack).drawToBitmap()
  
  
              //here is where I prepared it for transfer to the next activity (NOTE!: the value here is Parceable? , I chose this bcause it works with bitmaps)
            intent.putExtra(&quot;pictureStackCompleted&quot; , pictureStackCompleted)
              
              //here is where I told activity2 to start
              startActivity(intent)
  
  
  
          }```
  
  </code></pre>
  <p><strong>Here is whats on Activity2</strong></p>
  <pre><code>        super.onCreate(savedInstanceState)
          setContentView(R.layout.activity_save_and_name)
  
          //here is where I called the variable containing, my relative layout turned bitmap image
          val completedPicture = intent.getParcelableExtra&lt;Bitmap&gt;(&quot;pictureStackCompleted&quot;)
  
          //here I set my image to be the background image of an ImageView on activity2
         val finalImage = findViewById&lt;ImageView&gt;(R.id.finalImage)
          finalImage.setImageBitmap(completedPicture)
      }
  </code></pre>
  <p>I am 100% sure it has somehting to do with the bitmap conversion line because I tested that line of code by moving it out of intent to another part of the app ( which worked fine). when I ran the app that working part no longer functioned.</p>