I am having a very strange problem. What I think is happening is that a buffer is filling up, because the phone cannot display the information fast enough and then my program becomes non responsive.
Here is the Interrupt function.
Basically what happens is you press "Start" and then the button alters state and turns into a "stop" button when you press stop the button reverts to a start button.
Code:public void commandAction(Command command, Displayable displayable) { if(command == StartCommand) { MainForm.removeCommand(StartCommand); MainForm.addCommand(get_StopCommand()); run(); } if(command == StopCommand) { MainForm.removeCommand(StopCommand); MainForm.addCommand(get_StartCommand()); stopServices(); } }
here is a snippet of the code
I originally had this running in a thread, but to try to find out what was going on, I simplified it a lot.Code:private void stopServices() { quit(); } public void run() { while(QUIT == false) { System.out.println("Recorder"); try{ { System.out.println("pause1"); // Thread.sleep(1000); System.out.println("pause2"); } } catch (Exception ex) { System.err.println("Error in recorder thread: " + ex.toString()); } } } public void quit() { QUIT = true ; }
Is Thread.sleep() the best thing to do to get the thing to pause for an amount of time so that it prints out every second rather than continuously?
I will have 3 threads in the future. One to get GPS coords , one to calculate a route and one to give the user instructions.

Reply With Quote

