When previewing our custom views on Android Studio, there are some occasions when calculations can be very complex or, for example, we need some data initialized, but we can't do that while showing our custom view inside the preview window of Android Studio. We'll be able to do something about this by checking the is InEditMode() method.
This method will return true if we are inside an IDE or a development tool. Knowing this information, we could easily mock some of the data or simplify the rendering to just show a preview of what we want to draw.
For example, in the Example07-BuilderPattern folder in the GitHub repository, we are calling this method at the custom view creation to alter the color values used in the gradient, although we could actually call it during the onDraw() method as well, to alter the rendering of the view:
![](assets/caf6b140-52e3-494b-8ca1-e8a86b627326.png)