1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| @Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// récupération de la vue Button
b = (Button)findViewById(R.id.jouer);
b.setEnabled(false);
final Midi m = this;
// ajout d'un évènement sur le bouton
b.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View v) {
Intent i = new Intent(m, MainActivity.class);
startActivity(i);
}
});
Log.i(TAG, "app started ========================");
Button bluetoothScanButton = (Button) findViewById(R.id.bluetooth_scan); <= bouton à appuyer pour lancer l'activité
bluetoothScanButton.setOnClickListener(mBluetoothScanListener); <= fonction lançant l'activité lors d'un click
ListView listView = (ListView) findViewById(R.id.open_device_list);
listView.setEmptyView(findViewById(R.id.empty));
// Initializes list view adapter.
mOpenDeviceListAdapter = new OpenDeviceListAdapter();
listView.setAdapter(mOpenDeviceListAdapter);
if (getPackageManager().hasSystemFeature(PackageManager.FEATURE_MIDI)) {
setupMidi();
} else {
Toast.makeText(Midi.this, "MIDI not supported!",
Toast.LENGTH_LONG).show();
bluetoothScanButton.setEnabled(false);
}
} |
Partager