Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Java Micro Edition and the fly likes Terminating Network Communication Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "Terminating Network Communication" Watch "Terminating Network Communication" New topic
Author

Terminating Network Communication

Danish Shaukat
Ranch Hand

Joined: Nov 16, 1999
Posts: 340
Hi all,

I am using a separate thread for exchanging data between my midlet and servlet. Is there any way to terminate or cancel this operation?

Since there is no way to forcibly stop a thread in CLDC 1.0, so how will a user cancel the network communication? This might be required if it is taking too long or for any other reason.

Danish
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17257
    
    6

Well if it was my phone, I'd just hit the "Cancel" button. Basically I can end anything hitting this key. It is the "Hang up call" button.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Danish Shaukat
Ranch Hand

Joined: Nov 16, 1999
Posts: 340
Mark,

Thanks for replying. Some phones do have this Cancel button. But this is the phone�s Cancel button. It is not a command mapped on to the soft key by the midlet. Hitting this will destroy the midlet and the user will exit.

So, is there a way of programmatically terminating network communication/threads in J2ME?

Danish
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17257
    
    6

You can always add a Command to the "Screen" using the Command object, and selecting it would kill the application.

Mark
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Terminating Network Communication