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

New Developer
Posts: 26
Registered: ‎11-20-2008
My Device: Not Specified
Accepted Solution

Problem using Invoke.invoke from an non-UI Application

[ Edited ]



I have an application that displays a PopupScreen that consumes only part of the screen. Currently, I have designed the application as an "Application" vs "UiApplication" so I don't see the ugly white screen of death. I have been pushing my screen as a Global screen fine.


The problem is that now I want to use the Invoke API to open a new message pre-populated with a destination. When I call:



Invoke.invokeApplication(Invoke.APP_TYPE_MESSAGES, new MessageArguments(tm));

where "tm" implements javax.wireless.messaging.TextMessage.


The problem is that I get a ClassCastException because the Invoke API is trying to call getUiApplication.



Thread [project(125)id=1035919360] (Suspended (exception ClassCastException))
UiApplication.getUiApplication() line: 474
SMSEditorScreen(ModelScreen).go(boolean) line: 460
SMSEditorScreen(ModelScreen).go() line: 454
SMSEditorScreen.run() line: 739
SMSEditorScreen.runEditor(Object, SMSModel) line: 563
SMSComposeVerb.runEditor(ContextObject, SMSModel) line: 213
SMSComposeVerb.doInvoke(Object) line: 174
SMSComposeVerb(ShowMessageAppVerb).invoke(Object) line: 76
Invoke.invokeVerb(Verb, Object) line: 733
Invoke.invokeApplication(int, ApplicationArguments) line: 413


Is there a way I can make my application a UiApplication that only consumes part of the screen without a white background or workaround the problem some other way?

Message Edited by jeffm on 02-10-2009 06:39 PM
BlackBerry Development Advisor
Posts: 15,856
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Problem using Invoke.invoke from an non-UI Application

You can accomplish this by extending UiApplication.  When your application starts, have it call Application.requestBackground to move it to the background before you push your popup screen.  This avoids the white screen background.  You can also override Application.acceptsForeground to return false, preventing your application from showing up in the task switcher.


This should also allow you to use the invoke class.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.