Only unregister USB receiver if it was registered

This will probably prevent a crash on pre-Honeycomb devices.
master
Raph Levien 11 years ago
parent 26558930c0
commit 838535ec9c
  1. 2
      android/src/com/levien/synthesizer/android/ui/PianoActivity2.java

@ -189,7 +189,9 @@ public class PianoActivity2 extends Activity {
protected void onPause() { protected void onPause() {
Log.d("synth", "activity onPause"); Log.d("synth", "activity onPause");
androidGlue_.setPlayState(false); androidGlue_.setPlayState(false);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1) {
unregisterReceiver(usbReceiver_); unregisterReceiver(usbReceiver_);
}
setMidiInterface(null, null); setMidiInterface(null, null);
super.onPause(); super.onPause();
} }

Loading…
Cancel
Save