Question

I'm currently working with the Arduino Mega ADK and an Android tablet. My app consists of two activities. In the main activity everything works fine, and I'm able to control my app via the Arduino Mega ADK. How do I setup the second activity, so that it also gets access to the Arduino ADK?

The code for the first activity looks just like this one here.

Was it helpful?

Solution

One practical way would be to pass the instance via static member.

I'd go further and put all ADK startup/teardown logic into a separate class responsible for just that. In that case, you can insulate the logic and make the whole thing a service, and then communicate with it without ever touching ADK directly, or being even aware of its existence - this is what I did with my project.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top