下面列出了怎么用android.media.midi.MidiDevice.MidiConnection的API类实例代码及写法,或者点击链接到github查看源代码。
@Override
public void onPortsConnected(final MidiConnection connection) {
runOnUiThread(new Runnable() {
@Override
public void run() {
if (connection == null) {
Toast.makeText(MainActivity.this,
R.string.error_port_busy, Toast.LENGTH_SHORT)
.show();
mPortSelector.clearSelection();
} else {
Toast.makeText(MainActivity.this,
R.string.port_open_ok, Toast.LENGTH_SHORT)
.show();
}
}
});
}
@Override
public void onPortsConnected(final MidiConnection connection) {
runOnUiThread(new Runnable() {
@Override
public void run() {
if (connection == null) {
Toast.makeText(MainActivity.this,
R.string.error_port_busy, Toast.LENGTH_SHORT)
.show();
mPortSelector.clearSelection();
} else {
Toast.makeText(MainActivity.this,
R.string.port_open_ok, Toast.LENGTH_SHORT)
.show();
}
}
});
}
@Override
public void onPortsConnected(final MidiConnection connection) {
runOnUiThread(new Runnable() {
@Override
public void run() {
if (connection == null) {
Toast.makeText(MainActivity.this,
R.string.error_port_busy, Toast.LENGTH_LONG)
.show();
mPortSelector.clearSelection();
} else {
Toast.makeText(MainActivity.this,
R.string.port_open_ok, Toast.LENGTH_LONG)
.show();
}
}
});
}
/**
* Called to respond to a {@link #connectToDevicePort} request
*
* @param connection
* a {@link MidiConnection} that represents the connected
* ports, or null if connection failed
*/
abstract public void onPortsConnected(MidiConnection connection);
/**
* Called to respond to a {@link #connectToDevicePort} request
*
* @param connection
* a {@link MidiConnection} that represents the connected
* ports, or null if connection failed
*/
abstract public void onPortsConnected(MidiConnection connection);
/**
* Called to respond to a {@link #connectToDevicePort} request
*
* @param connection
* a {@link MidiConnection} that represents the connected
* ports, or null if connection failed
*/
abstract public void onPortsConnected(MidiConnection connection);
/**
* Called to respond to a {@link #connectToDevicePort} request
*
* @param connection
* a {@link MidiConnection} that represents the connected
* ports, or null if connection failed
*/
abstract public void onPortsConnected(MidiConnection connection);
/**
* Called to respond to a {@link #connectToDevicePort} request
*
* @param connection
* a {@link MidiConnection} that represents the connected
* ports, or null if connection failed
*/
abstract public void onPortsConnected(MidiConnection connection);