Question : Controlling main application threads from within an instance of a class

hello

i built a J2ME application that has the ability to track a mobile device using 3 options according to the value of the interval. the last interval value is stored in a record store.
The last value of the interval is checked at the application startup (in the public void startApp() function) and according to it an appropriate tracking method is applied.

1. if interval=0, the application track the mobile by registering a GPS listener as follows:

            // create a GPS listener thread
            GPSDataTextBox.setString("Listener");
            clsGPSListener GPSListener= new clsGPSListener(GPSDataTextBox,IPAddress,IMEI);
            new Thread(GPSListener).start();

2. if interval=-1, the application stop tracking.

3. if interval > 0, the tracking is done using a timer that runs on the specified interval as follows:

            // create a GPS interval thread
            GPSDataTextBox.setString("Interval (" + Interval +")");
            Timer tmrGPSInterval = new Timer();
            tmrGPSInterval.schedule(new clsGPSInterval(GPSDataTextBox,IPAddress,IMEI),0,Interval * 1000);


i build clsSMSListener that listen on SMS coming on a certain port. this sms contains the new interval the remote user want to track the mobile with. my problem is how can i control the threads of clsGPSListener and clsGPSInterval from the clsSMSListener. in another word: how can i start and stop the clsGPSListener and clsGPSInterval threads from within the clsSMSListener. i am using netbeans

Thanks in advance

Answer : Controlling main application threads from within an instance of a class

>does not stop the GPS listener

Then perhaps you have to dispose of it. E.g.

LocationProvider1.reset();
LocationProvider1 = null;

Also, you could try disposing of the timer. Basically, I think you need to remove all references to the LocationProvider object.
Random Solutions  
 
programming4us programming4us