Welcome to the Official BlackBerry® Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Developer
alphaAOomega
Posts: 17
Registered: 10-13-2009
Accepted Solution

Multiple JAVA files

If I have two fully independent java applications, is it possible for me to combine them into one application and create a menu item to switch between the two?

Please use plain text.
Developer
peter_strange
Posts: 14,611
Registered: 07-14-2008

Re: Multiple JAVA files

[ Edited ]

In general yes, though you might find some details make it more complicated.  And there is an alternative, which I will describe...

 

First option.  Assume that you have two standard RIM type applications, each of which pushes a MainScreen.  Call these screen A and screen B.  Combine, and then have your main push Screen 1 - which can have two buttons it which push screen 1 and screen 2 respectively.  Aside from that you can pretty much leave the two applications alone, they will work OK independently, assuming they have different package/class names.

 

Another alternative is to create an alternate entry.  You have your standard application that pushes Screen A.  Create an alternate entry, specifying a different main string (let us say it specified "B" as the parameter).  Now in the main() method, check for the "B" and then create another Application instance and a completely separate 'enterEventDispatcher which pushes screen B'.  This will give you two different applications, with two different icons, but only one set of cods, 

 

Not sure you want the second option (two different icons) but thought I would mention it for completeness.

Please use plain text.
Developer
alphaAOomega
Posts: 17
Registered: 10-13-2009

Re: Multiple JAVA files

Thanks!  I don't know what I was doing wrong, so I just rewrote everything from scratch and it's working perfectly like you have laid out in the first option.

Please use plain text.