07-21-2010 12:18 AM
I am trying to integrate the GPS Demo Java program into my own independent program by calling the GPSDemo class from my program. I tried using:
but all i get is an error saying that the class is "multiply defined"
Is there some easy way I could modify the UserInterface class to include a GPS or some other type of field? Or is there some other way of integrating the GPS program?
Thanks in Advance.
07-21-2010 12:37 AM
Welcome to the forums!
There are three basic ways to use the sample programs:
I gather that you were trying to do something like #2, but with the entire sample app. That doesn't work because one UiApplication subclass can't be added to another one. Among the pieces that can be copied fairly easily are screens, fields, menu items, and non-UI methods of interacting with the device. If you aren't too far along with your app, though, you might consider option 3.
07-22-2010 01:10 AM - edited 07-22-2010 01:11 AM
Thanks for the advice but I couldn't seem to get your suggestions to work. I still got too many errors, probably because I'm not too sure what I'm doing.
I decided to make an easy program to access the GPSDemo but even though I am literally copying the same UserInterface sample program code(which runs perfectly fine), I am getting different errors.
With the following code, I am getting a "Warning!: method 'odometer.Odometer.main(String)' not invoked." indicated at "Odometer theApp = new Odometer();"
Why doesn't java invoke the public static main?
Please Help! Thanks in Advance
- Aggrivated Student
07-22-2010 01:24 AM
I'm not sure why you're getting the warning. Are you using Eclipse?
Be aware that the call to enterEventDispatcher never returns. So by calling GPSDemo().enterEventDispatcher() in the c'tor for OdometerScreen, that's the end of your code's execution. I'd be curious to know if the warning goes away if you comment out that line.
What exactly are you trying to do?