Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Super Contributor
Posts: 253
Registered: ‎08-19-2010
My Device: BB10, Playbook, 9900, 9800, 9700, 9550, 9530, 9500, 8700.
My Carrier: TT

How to close all thread and files complete without closing program?

Situation:

Intend to add a button to restart program.

When program is restarted, data files, which cannot be saved, always show 0 byte.

 

Possible reason:

1.Closing thread and files is not complete.

 

Problem:

1.How to close all threads and files completely without closing program?

   or 

   How to restart a program?

2.Try to find a code like system.exit(0), but the whole program is not closed.

 

Final purpose:

1.Restart a program

 

-Fight with BB10
Super Contributor
Posts: 253
Registered: ‎08-19-2010
My Device: BB10, Playbook, 9900, 9800, 9700, 9550, 9530, 9500, 8700.
My Carrier: TT

Re: How to close all thread and files complete without closing program?

I found a way to solve the issue, but the restart program takes about 10 seconds to dot the restart job.

 

Solution resouce:

http://208.74.204.192/t5/Java-Development/restart-application-automatically/td-p/1064819

 

ApplicationDescriptor current = ApplicationDescriptor.currentApplicationDescriptor();
ApplicationManager.getApplicationManager().scheduleApplication(current, System.currentTimeMillis() +0, true);
System.exit(0);

 

Does anyone know how to short the timing?

 

-Fight with BB10