# Print output for @column tags ?> MidiManager - Android SDK | Android Developers

Most visited

Recently visited

MidiManager

public final class MidiManager
extends Object

java.lang.Object
   ↳ android.media.midi.MidiManager


This class is the public application interface to the MIDI service.
Requires the PackageManager#FEATURE_MIDI feature which can be detected using PackageManager.hasSystemFeature(String).

Summary

Nested classes

class MidiManager.DeviceCallback

Callback class used for clients to receive MIDI device added and removed notifications 

interface MidiManager.OnDeviceOpenedListener

Listener class used for receiving the results of MidiManager.openDevice(MidiDeviceInfo, MidiManager.OnDeviceOpenedListener, Handler) and MidiManager.openBluetoothDevice(BluetoothDevice, MidiManager.OnDeviceOpenedListener, Handler) 

Public methods

MidiDeviceInfo[] getDevices()

Gets the list of all connected MIDI devices.

void openBluetoothDevice(BluetoothDevice bluetoothDevice, MidiManager.OnDeviceOpenedListener listener, Handler handler)

Opens a Bluetooth MIDI device for reading and writing.

void openDevice(MidiDeviceInfo deviceInfo, MidiManager.OnDeviceOpenedListener listener, Handler handler)

Opens a MIDI device for reading and writing.

void registerDeviceCallback(MidiManager.DeviceCallback callback, Handler handler)

Registers a callback to receive notifications when MIDI devices are added and removed.

void unregisterDeviceCallback(MidiManager.DeviceCallback callback)

Unregisters a DeviceCallback.

Inherited methods

Public methods

getDevices

public MidiDeviceInfo[] getDevices ()

Gets the list of all connected MIDI devices.

Returns
MidiDeviceInfo[] an array of all MIDI devices

openBluetoothDevice

public void openBluetoothDevice (BluetoothDevice bluetoothDevice, 
                MidiManager.OnDeviceOpenedListener listener, 
                Handler handler)

Opens a Bluetooth MIDI device for reading and writing.

Parameters
bluetoothDevice BluetoothDevice: a BluetoothDevice to open as a MIDI device

listener MidiManager.OnDeviceOpenedListener: a MidiManager.OnDeviceOpenedListener to be called to receive the result

handler Handler: the Handler that will be used for delivering the result. If handler is null, then the thread used for the listener is unspecified.

openDevice

public void openDevice (MidiDeviceInfo deviceInfo, 
                MidiManager.OnDeviceOpenedListener listener, 
                Handler handler)

Opens a MIDI device for reading and writing.

Parameters
deviceInfo MidiDeviceInfo: a MidiDeviceInfo to open

listener MidiManager.OnDeviceOpenedListener: a MidiManager.OnDeviceOpenedListener to be called to receive the result

handler Handler: the Handler that will be used for delivering the result. If handler is null, then the thread used for the listener is unspecified.

registerDeviceCallback

public void registerDeviceCallback (MidiManager.DeviceCallback callback, 
                Handler handler)

Registers a callback to receive notifications when MIDI devices are added and removed. The DeviceCallback#onDeviceStatusChanged method will be called immediately for any devices that have open ports. This allows applications to know which input ports are already in use and, therefore, unavailable. Applications should call getDevices() before registering the callback to get a list of devices already added.

Parameters
callback MidiManager.DeviceCallback: a DeviceCallback for MIDI device notifications

handler Handler: The Handler that will be used for delivering the device notifications. If handler is null, then the thread used for the callback is unspecified.

unregisterDeviceCallback

public void unregisterDeviceCallback (MidiManager.DeviceCallback callback)

Unregisters a DeviceCallback.

Parameters
callback MidiManager.DeviceCallback: a DeviceCallback to unregister