views:

94

answers:

3

Hi, I have created an application of contacts synchronization. when i run it on device it hangs my device while synchronizing then i am not able to open another application, I am also doing auto synchonization with in a perticular period of time.

I want that synchronization should be perform without hang to device and if i get any interrupt i.e. any call while syncing then it should pause for that moment and continue at call end. How can i do this ?

A: 

It sounds like you are performing the synchronisation on the UI thread - perhaps you need to ship it onto a different thread.

Sohnee
I have created a diiferent thread for synchronization, but it hangs to device.
Rishabh
A: 

I dont know how this is working for Blackberry, but may be an example for Eclipse RCp is helping you.

You have the choice to execute a Runnable between

The thread which calls this method is suspended until the runnable completes.

Display.getDefault().syncExec(runnable);

The caller of this method continues to run in parallel, and is not notified when the runnable has completed.

Display.getDefault().asyncExec(runnable);

In your case you have to make the decision if you can start the job in asynch mode.

When you ar enot sure, whether your job is executed in asynch mode, you should implement some outputs to the console including timestamp.

Markus Lausberg
A: 

See the other answers to your same question at http://stackoverflow.com/questions/1643331/how-can-i-schedule-a-particular-thread-in-blackberry

nope