MidiScope/Application/src/main/java/com/example/android/common/midi/MidiInputPortSelector.java [50:71]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public void onPortSelected(final MidiPortWrapper wrapper) {
        close();
        final MidiDeviceInfo info = wrapper.getDeviceInfo();
        if (info != null) {
            mMidiManager.openDevice(info, new MidiManager.OnDeviceOpenedListener() {
                    @Override
                public void onDeviceOpened(MidiDevice device) {
                    if (device == null) {
                        Log.e(MidiConstants.TAG, "could not open " + info);
                    } else {
                        mOpenDevice = device;
                        mInputPort = mOpenDevice.openInputPort(
                                wrapper.getPortIndex());
                        if (mInputPort == null) {
                            Log.e(MidiConstants.TAG, "could not open input port on " + info);
                        }
                    }
                }
            }, null);
            // Don't run the callback on the UI thread because openInputPort might take a while.
        }
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



MidiSynth/Application/src/main/java/com/example/android/common/midi/MidiInputPortSelector.java [50:71]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public void onPortSelected(final MidiPortWrapper wrapper) {
        close();
        final MidiDeviceInfo info = wrapper.getDeviceInfo();
        if (info != null) {
            mMidiManager.openDevice(info, new MidiManager.OnDeviceOpenedListener() {
                    @Override
                public void onDeviceOpened(MidiDevice device) {
                    if (device == null) {
                        Log.e(MidiConstants.TAG, "could not open " + info);
                    } else {
                        mOpenDevice = device;
                        mInputPort = mOpenDevice.openInputPort(
                                wrapper.getPortIndex());
                        if (mInputPort == null) {
                            Log.e(MidiConstants.TAG, "could not open input port on " + info);
                        }
                    }
                }
            }, null);
            // Don't run the callback on the UI thread because openInputPort might take a while.
        }
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



