Graphics Programs Reference
In-Depth Information
final ActivityManager activityManager =
(ActivityManager)
getSystemService(Context.ACTIVITY_SERVICE);
final ConfigurationInfo configurationInfo =
activityManager.getDeviceConfigurationInfo();
final boolean supportsEs2 =
configurationInfo.reqGlEsVersion >= 0x20000;
TextView tv = (TextView)
findViewById(R.id.textview1);
if (supportsEs2) {
tv.setText("es2 is supported");
} else {
tv.setText("es2 is not supported");
}
}
In the onCreate method ( Listing 1-2 ) , we obtain the device configuration attrib-
utes and use them to detect the version of OpenGL ES running on the device. Next,
we find the TextView in the UI layout of our application by its id (“textview1”)
and use it to display the result using its setText method.
Now the application is ready for use. However, before running this application on a
real device, we will test it on the Android Emulator. If you haven't created a virtual
device yet, start the AVD Manager and complete the following steps:
1. Click “New” to open the window to create a new virtual device.
2. Name this virtual device “IceCreamSandwich”. We are targeting (at
least) the Ice Cream Sandwich emulator, so we will name it
IceCreamSandwich. You may also modify this name to indicate the res-
olution of virtual device.
3. Under target, select API level 15, as shown in Figure 1-9 .
 
Search WWH ::




Custom Search