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 Developer
Posts: 126
Registered: ‎06-09-2010
My Device: 9000
My Carrier: T Mobile
Accepted Solution

Alternate entry point for application issue

[ Edited ]

Hi,

As I read on this KB about alternate application entry point

http://supportforums.blackberry.com/t5/Java-Development/Set-up-an-alternate-entry-point-for-an-appli...

But on the above KB, the main application is UiApplication and alternate entry point is not UiApplication!

1. I wonder how to create the alternate entry point in which both project is UiApplication

2. For example, I have main application which have 3 screens A, B, C. When user click on the icon of main Application, Screen A displays. When user click on the alternate entry point application (another icon on home screen), screen B display. I wonder how can we do that?

 

Thanks.

Developer
Posts: 16,999
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Alternate entry point for application issue

what code you use in the AEP is up to you, it just calls your static main with a different parameter. you can create a new uiapplication instance there without a problem.
or you could launch your main application, but tell it to display screen B.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
New Developer
Posts: 126
Registered: ‎06-09-2010
My Device: 9000
My Carrier: T Mobile

Re: Alternate entry point for application issue

I'm not clear about that. For example, I have an AEP setting like that:

On the AEP project I do this (let's call this gui1 project, empty code)

1. Have an icon

2. Show icon on Home Screen

 

 

On the main project I added the AEP like this: (let's call this main project)

1. Have an icon

2.  on AEP tab, Appplication argument is :"gui1" 

3. The main code of Main project is:

 

public static void main (String [] args) 
{
if ( args != null && args.length > 0 && args[0].equals("gui1") ){
UiApplication.getUiApplication().pushScreen(new CForms());
}
else{
AppMain sample = new AppMain();
sample.enterEventDispatcher(); } 
}

 

I catch the error "no application instance " when I click on the AEP icon on home screen. can you tell me how to fix this.

Developer
Posts: 16,999
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Alternate entry point for application issue

there is no UiApplication you can retrieve in the main method, you have to create one, same as in the other entry point.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
New Developer
Posts: 126
Registered: ‎06-09-2010
My Device: 9000
My Carrier: T Mobile

Re: Alternate entry point for application issue

So, on the AEP app, we have:

1. Extend Uiapplication to call screen from main app?

2. Require the main() as usual?

 

I've add code for AEP app extends Ui with no main(), also the error "no application instance"

Developer
Posts: 16,999
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Alternate entry point for application issue

public static void main (String [] args) 
{
if ( args != null && args.length > 0 && args[0].equals("gui1") ){
AppAEP sample = new AppAEP();
sample.enterEventDispatcher(); 
}
else{
AppMain sample = new AppMain();
sample.enterEventDispatcher(); } 
}

 modified your code. the AEP is a completly different application instance.

 

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Highlighted
New Developer
Posts: 126
Registered: ‎06-09-2010
My Device: 9000
My Carrier: T Mobile

Re: Alternate entry point for application issue

[ Edited ]

Thanks simon for quick response.

But how can I call ScreenB (original from project AppMain) on project AppAEP?

I don't want to add ScreenB.java again on AppAEP because ScreenB works on AppMain with many files and library, if add again, we have two app with the same purpose and double size

How can I do that?

Developer
Posts: 16,999
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Alternate entry point for application issue

it's all one project, you can access all classes.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
New Developer
Posts: 126
Registered: ‎06-09-2010
My Device: 9000
My Carrier: T Mobile

Re: Alternate entry point for application issue

On Eclipse I created 2 project (AppMain and AppAEP), on AppAEP, I tried to call ScreenB but I cannot do that 

Eclipse always notify error on AppAEP.

Developer
Posts: 16,999
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Alternate entry point for application issue

no, you create only one project. the AEP is set on the application descriptor.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter