Game Development Reference
In-Depth Information
Figure 8-6. Wiimote app user interface
Figure 8-6 shows the XML layout of the app. It has buttons to interact with the Wiimote
including Connect, Disconnect, Rumble (to trigger the controller rumble feature), Status (to
get the status of the controller), and Send (to post an array of test bytes to the controller),
plus a log window that will display messages sent from the device. The XML layout is loaded
from the WiiTestActivity , as shown in Listing 8-1.
Listing 8-1. Wiimote Test Main Activity
public class WiiTestActivity extends Activity {
static final String TAG = "WiiTest";
IController wii;
Handler mHandler = new Handler();
EditText etLog;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// set layout XML
setContentView(R.layout.main);
etLog = (EditText) findViewById(R.id.editText2);
 
Search WWH ::




Custom Search