Listing installed Cardboard apps
If you haven't forgotten, the purpose of this LauncherLobby app is to show a list of Cardboard apps on the device and let the user pick one to launch it.
If you like what we've built so far, you may want to save a copy for future reference. The changes we're going to make next will significantly modify the code to support a list of views as shortcuts to your apps.
We're going to replace the addContent
method with addShortcut
and the imageView
and textView
variables with a list of shortcuts. Each shortcut consists of an ImageView
and a TextView
to display the shortcut, as well as an ActivityInfo
object for the purpose of launching the app. The shortcut images and text will appear on top of each other, as shown earlier, and will be arranged horizontally in a line, a fixed distance apart.
Queries for Cardboard apps
First, let's get the list of Cardboard apps installed on the device. At the end of the onCreate
method of MainActivity
, add a call to a new method, getAppList...