I\'m trying to develop an external library (not sure if that\'s the right term) to provide prepackaged functionality in Android projects. Working in Eclipse, I\'ve added the app
Is there any way for me to include these two Android classes and still be able to test my library standalone?
Not readily, by any means I can think of.
Do I need to have the Android source available?
I don't know where else you would get the implementation from. But, more importantly, those things are not designed to work in isolation outside of the OS, any more than you could just grab a Cocoa class or two and pull them into your Objective-C library and expect them to run on a Windows box.
Off the cuff, knowing nothing about what you're building, I would make whatever dependency you are introducing on Handler
and Message
be more pluggable. Test outside of Android using a pure-Java implementation, perhaps even just some mocks. Test inside of Android using the real implementation.
You could try the lib Robolectric, that implements the android API so you would be able to create JUnit tests for some isolated code you have:
http://robolectric.org/