Next, we'll add an icon image to the view.
For now, let's just use a generic icon, such as
android_robot.png. A copy of this can be found on the Internet, and there's a copy included with the files for this chapter. Paste the
android_robot.png file into your project's
app/res/drawable/ folder. Don't worry, we'll be using the actual app icons later.
We want to display both the text and an icon together, so we can add the code in order to add the image views to the
onCreate method of
MainActivity, modify the
addContent call to pass the icon as a second parameter:
Drawable icon = getResources() .getDrawable(R.drawable.android_robot, null); overlayView.addContent("Hello Virtual World!", icon);