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
Developer
myraddin
Posts: 412
Registered: ‎09-12-2008
My Device: 9000 9810
Accepted Solution

Use this key to insert a dollar, pound ... message !?

I have just started playing with 8800 simulator (on OS 4.5) and have found this strange behavior.

 

When user presses loudspeaker key ($ or € - in euro version)  I get a popup

"Use this key to insert a dollar, pound..." :smileysad:

 

I don't want this to happen.

 

Why is it appearing, and how can I disable it ?

 

BTW, my screen extends MainScreen and implements KeyListener for handling key events.



"Listen carefully, I shall say this only once"
Please use plain text.
Developer
myraddin
Posts: 412
Registered: ‎09-12-2008
My Device: 9000 9810

Re: Use this key to insert a dollar, pound ... message !?

Further research:

It never showed up in the Dialer !? How can that be ? How could the dialer disable that popup ? I want to do that also :smileysad:.

 

But after I selected and option ($, €...) it never showed it self again.

 

How to disable/skip it in the first place ?



"Listen carefully, I shall say this only once"
Please use plain text.
Developer
simon_hain
Posts: 16,137
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: Use this key to insert a dollar, pound ... message !?

i don't know of a way to disable this programmatically. once it is set the popup should never come again. you can try to set it manually in options/display-keyboard, but not sure if it helps.
----------------------------------------------------------
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
Please use plain text.
Developer
myraddin
Posts: 412
Registered: ‎09-12-2008
My Device: 9000 9810

Re: Use this key to insert a dollar, pound ... message !?

Thanks for the effort Simon but this is still not enough.

 

It's rather silly.

I implement key listener and the user presses the currency key (ludspeaker/$) and the popup goes on top.

 

The strange thing is that the listener is still active and since I consume most of the keys the popup remains on top until i close my screen (the listener unregisters)

 

So I am stuck ;( 

I also tried to use the Keypad.hasCurrencyKey() to inform the user (or to prepare my app) of the problem, but that didn't work either. It always returned true.

 

Has anyone found a workaround?

(I hesitate to go to keyInjection techniques as I don't want to set the key to some value the user didn't choose. )

 

So I am kinda stuck to writing to the manual: "The currency key must be set before starting the application"  :smileysad:



"Listen carefully, I shall say this only once"
Please use plain text.
Administrator
MSohm
Posts: 14,569
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook

Re: Use this key to insert a dollar, pound ... message !?


myraddin wrote:

The strange thing is that the listener is still active and since I consume most of the keys the popup remains on top until i close my screen (the listener unregisters)


I haven't been able to reproduce this part.  What is the exact 4 digit 4.5.0.x version you are testing with?  Can you post sonme sample code?

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
Developer
myraddin
Posts: 412
Registered: ‎09-12-2008
My Device: 9000 9810

Re: Use this key to insert a dollar, pound ... message !?

It's rather easy to reproduce.

I am testing in simulator v 2.9.0.52. OS 4.5.0.7 with a 8800 device. 

But I have already tested on the real device on both 8800 (4.5.0) and Bold (4.6.0)

 

There are two ways to get this behavior:

 

1) Application derived app. pushing global screen which implements key listener. 

2) Application derived app. implementing phone listener pushing global screen implementing key listener

 

The behaviour is somewhat different: 

 

Here's the code:

 

(main app)

 

public class MainApp extends Application implements PhoneListener { private static MainApp app;

public static int SCENARIO_VERSION = 1;

public static int SCENARIO_NO_PHONE_LISTENER = 1;
public static int SCENARIO_PHONE_LISTENER = 2;

 

public static void main(String[] args) { app = new MainApp(); Phone.addPhoneListener(app);

if (MainApp.SCENARIO_VERSION == MainApp.SCENARIO_NO_PHONE_LISTENER)

{

Application.getApplication().invokeLater(new Runnable() { public void run() { // Scenario 1: Ui.getUiEngine().pushGlobalScreen(new SomeScreen(), 4, UiEngine.GLOBAL_SHOW_LOWER); } });

}

app.enterEventDispatcher(); } public void callInitiated(int arg0) { if (MainApp.SCENARIO_VERSION == MainApp.SCENARIO_PHONE_LISTENER)
{
// Scenario 2:
Ui.getUiEngine().pushGlobalScreen(new SomeScreen(), 4, UiEngine.GLOBAL_SHOW_LOWER);
}

} . . . }

 

(the popup to be shown)

 

 

final public class SomeScreen extends MainScreen implements KeyListener { public void sublayout(int width, int height) { super.sublayout(width, height); int overlayScreenSize = 200; setExtent(200, overlayScreenSize - 50); setPosition(50, Display.getHeight() - overlayScreenSize); } protected void paintBackground(Graphics g) { g.setBackgroundColor(0xFAFAD2); g.clear(); } protected void applyTheme() { // This popup doesn't want any theme influence } public boolean keyChar(char aKeyCaracter, int aKeyStatus, int aTime) { return false; } public boolean keyDown(int aKeyCode, int aTime) { System.out.println("KeyListener " + Integer.toHexString(aKeyCode)); if (aKeyCode == 0x1b0000) { // ESC key pressed if (MainApp.SCENARIO_VERSION == MainApp.SCENARIO_NO_PHONE_LISTENER) { // Scenario 1: System.exit(0); } else { // Scenario 2: Ui.getUiEngine().popScreen(this); } } return true; } public boolean keyUp(int arg0, int arg1) { return false; } public boolean keyRepeat(int arg0, int arg1) { return false; } public boolean keyStatus(int arg0, int arg1) { System.out.println("keyStatus " + Integer.toHexString(arg0)); return false; } }

 

Here are the results of scenario 1: 

 

Normal global push version

 

And this is scenario 2: (Make a call then press currency key)

Phone listener and global push

 

 

 

The strangest thing is that in scenario 1 the popup isn't shown ! But if you press the currency key 5-10 times in a row, you will get a 'too many threads exception'.

The second anomaly is that my app never receives any key action event when the user presses the currency key in both scenarios while something is in fact sent. Why is the app's key listener being eluded ?

 

I don't want to go into RIM's details of implementation, the only thing that interests me is how to get the event that the currency key was pressed on a globally pushed screen :smileysad: if it was not set previously. Or how to tell the system not to bother me with it while my screen is on top.

 

Thanks for your interest

 

P.S. I have played arround the screen's priorities and  flags but could never achieve my final goal

 

 

 

 



"Listen carefully, I shall say this only once"
Please use plain text.
Administrator
MSohm
Posts: 14,569
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook

Re: Use this key to insert a dollar, pound ... message !?

You shouldn't implement KeyListener in a class that extends MainScreen.  MainScreen already has its own KeyListener.  This means that you now have 2 KeyListeners in the class, but are only overriding one set of KeyListener methods.

 

You can remove the second KeyListener implementation or implement the KeyListener in a different class, which you can then add to MainScreen.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
Developer
myraddin
Posts: 412
Registered: ‎09-12-2008
My Device: 9000 9810

Re: Use this key to insert a dollar, pound ... message !?

Sorry for the long delay. I just noticed you post (how rude of me - I've been avoiding the currency key for a long time - now I must deal with it)

 

Once again, very informative help from you, thanks. 

 

But unfortunately, the problem is not resolved.

 

I removed the ... implements KeyListener... part but the same problem is still present.

 

The 'Select currency key' dialog still pops up infront but doesn't catch the key inputs (everything is sent to my app).

 

How can I give control to the popup and later return to my screen ? (or how to remove the currency key popup in general ?)

 

Thanks again,

 

Myraddin



"Listen carefully, I shall say this only once"
Please use plain text.
Administrator
MSohm
Posts: 14,569
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook

Re: Use this key to insert a dollar, pound ... message !?

I have sent this issue to our development team.  The popupscreen should appear on top of your screen automatically.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.