-
March 17th, 2011, 11:14 AM
#1
forcefully stop a thread
Hi all,
I have a thread in J2ME which calls another application. My requirement is to forcefully stop the thread after some fixed interval..
Anyboday please help me to close the thread forcefully as the particular application can not be closed by itself and no code can be added in that application as it is system defined..
Thanks
-
March 17th, 2011, 12:36 PM
#2
Re: forcefully stop a thread
Can you clarify some points:
1. Are you saying you can't close the application called by the thread?
2. Is the application called by the thread an external executable?
3. Can you add code to the thread that calls the application?
4. How is the application called by the thread?
Precise language is not the problem. Clear language is the problem...
R. Feynman
Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.
-
March 18th, 2011, 03:10 AM
#3
Re: forcefully stop a thread
Thanks for the reply..
To give a brief summary about my task before answering the questions..
I am working on blackberry application development and my application calls the in built blackberry Map to show the particular location i want to display (Which i have succeeded) but the location keeps changing and I want to update the same on the map.. For this I dont want the user to forcefully close the application to show the update..
To answer ur questions..
1. I can close the application manually but I dont want that to be done.
2. Yes.. The thread calls an external application.
3. Yes.. I am able to add the code and call the application.
4. The application is called by blackberry api Invoke.
Some code snippet for your reference
public class UpateThread extends Thread{
BM_SingleLoc singleLocScreen;
public UpateThread(BM_SingleLoc singleLocScreen){
this.singleLocScreen = singleLocScreen;
}
public void run(){
//for(;{
try{
Thread.sleep(10000);
}catch(InterruptedException e){
// Catch the exception here
}
UiApplication.getUiApplication().invokeLater(new Runnable() {
public void run() {
// TODO Auto-generated method stub
singleLocScreen.callMap();
}
});
//}
}
}
---------------------
public final class BM_SingleLoc extends MainScreen
{
public BM_SingleLoc()
{
UpateThread thread = new UpateThread(this);
thread.start();
}
public void callMap(){
String document = "<lbs clear='ALL'><location lon='-7938675' lat='4367022' label='Toronto, ON' description='Go Leafs Go!' zoom='10'/></lbs>";
Invoke.invokeApplication(Invoke.APP_TYPE_MAPS, new MapsArguments( MapsArguments.ARG_LOCATION_DOCUMENT, document));
}
}
-
March 19th, 2011, 02:07 PM
#4
Re: forcefully stop a thread
When posting code use the CODE tags so it stays readable (see my sig).
If it's just a question of stopping a thread, why don't you run a timer whose task interrupts the thread?
I'm not really sure what the problem is here...
The outcome of any serious research can only be to make two questions grow where only one grew before...
T. Veblen
Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|