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
New Contributor
entity1977
Posts: 5
Registered: ‎03-31-2011
My Device: 9800
My Carrier: my

Start an application from another application

Hi, I'm starting to program with blackberry, and i have just to do something too difficult for me. I have to launch an application from another application after displayng an immage in the first one.

I'm trying to start with launching 2 hello world applications, like an example i found:

 

....


LabelField lableField =

new LabelField("Ciao");


add(lableField);


 

int modHandle = CodeModuleManager.getModuleHandle("Hello2");


ApplicationDescriptor[] apDes = CodeModuleManager.getApplicationDescriptors(modHandle);

ApplicationManager.getApplicationManager().runApplication(apDes[0]);

....

 

But nothing appends after i see first lable "Ciao"

 

Can someone please help me?

Please use plain text.
Developer
dx22
Posts: 402
Registered: ‎11-26-2010
My Device: Torch

Re: Start an application from another application

Try putting some prints and give us more info.

What is the value of the variable modHandle? Is it 0?

Is  the apDes array empty?

----------------------------------------------------------------------
Press the button to give kudos if I helped you :smileyhappy:
Please use plain text.
Developer
indusBULL
Posts: 207
Registered: ‎09-10-2010
My Device: Not Specified

Re: Start an application from another application

Agree with dx22 that more info is definitely required. Also mention how are u launching the another app? Do u have any button? Labelfield is used usuallt to display any text.  And before running application, check the value of module handle

 

 

if(modHandle != 0){
     ApplicationManager.getApplicationManager().runApplication(apDes[0]);									
}

 

 

 

 

Please use plain text.
New Contributor
entity1977
Posts: 5
Registered: ‎03-31-2011
My Device: 9800
My Carrier: my

Re: Start an application from another application

i've put some  Sleep cicle before to launch the second application, now i can see my second application but before to see my lable i put before to launch the application :-(

And When i launch my application second time is just the opposite thing.

There is some stupid synchronization problem

 

public class HelloWorldMainScreen extends MainScreen{
    /**
     * Entry point for application
     * @param args Command line arguments (not used)
     * @throws ApplicationManagerException
     */
 private LabelField myLable;
 
 public HelloWorldMainScreen() throws ApplicationManagerException  {  
  myLable = new LabelField("Ciao");
  add(myLable);
  MainScreenUpdaterThread thread = new MainScreenUpdaterThread(this);
  thread.start(); 
 
  int modHandle = CodeModuleManager.getModuleHandle("Hello2");
  ApplicationDescriptor[] apDes = CodeModuleManager.getApplicationDescriptors(modHandle);
  if(modHandle != 0){
       ApplicationManager.getApplicationManager().runApplication(apDes[0]);        
  }


 }

Please use plain text.