Giter Site home page Giter Site logo

Comments (3)

planethcom avatar planethcom commented on June 12, 2024

Hi Kaoru

I’d recommend to put all the driver setup into some separate class, a singleton, or all ‘static’ is fine too.

Then initialize that class on startup and destroy everything inside when the app gets terminated.

Having the midi setup in an activity is, from the software design point of view, not a very good practice, since there’s no guarantee how long an activity will live. Screen rotation is just one example.

Von: Kaoru Shoji [mailto:[email protected]]
Gesendet: Freitag, 8. Mai 2015 05:24
An: kshoji/USB-MIDI-Driver
Betreff: [USB-MIDI-Driver] OnMidiDeviceDetachedListener method doesn't called at the screen rotation (#38)

The execution of handler on MidiDeviceConnectionWatcher is blocked while the screen rotating.
After the new Activity's onCreate being called, the handler will be executed.
But the original Activity is already destroyed, so the original Activity can't receive detaching events.


Reply to this email directly or view it on GitHub #38 . https://github.com/notifications/beacon/AF5BLIYAZZW8dxFolc9snBIQe6niLO8eks5oHCPegaJpZM4ETQts.gif

from usb-midi-driver.

kshoji avatar kshoji commented on June 12, 2024

Hi,
I also think the Activity should not hold MIDI device instances.
Their instances should belong at Application, Service or something static object.

The sample code had written at long ago. It must be refined.

from usb-midi-driver.

planethcom avatar planethcom commented on June 12, 2024

Ah, OK, didn’t know that.

Agree, storing it in a custom application class would be even better than using a regular singleton

Von: Kaoru Shoji [mailto:[email protected]]
Gesendet: Freitag, 8. Mai 2015 11:24
An: kshoji/USB-MIDI-Driver
Cc: planethcom
Betreff: Re: [USB-MIDI-Driver] OnMidiDeviceDetachedListener method doesn't called at the screen rotation (#38)

Hi,
I also think the Activity should not hold MIDI device instances.
Their instances should belong at Application, Service or something static object.

The sample code had written at long ago. It must be refined.


Reply to this email directly or view it on GitHub #38 (comment) . https://github.com/notifications/beacon/AF5BLAI93qe5ZgKzb_mFhSWmA9Zpzp0Jks5oHHg8gaJpZM4ETQts.gif

from usb-midi-driver.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.