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
shea08
Posts: 121
Registered: ‎03-25-2009
My Device: Z30
Accepted Solution

Bug with file picker? Unauthorized keyboard access?

[ Edited ]

My main screen listens to the escape and enter keys. The main screen has a button, that launches a FilePicker (via anonymous Runnable instance).  When the FilePicker is launched, I get an Unauthorized keyboard listener exception. 

 

This only happens to some of my customers.  On a Storm 2, and and on an 8530. No one else has complained about it, and I am unable to duplicated it on any simulator.

 

Would wrapping it in an invokeAndWait later fix the problem? is this a known bug? is there a known work around?

 

Thanks,
~S

Please use plain text.
BlackBerry Development Advisor
MSohm
Posts: 14,677
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook

Re: Bug with file picker? Unauthorized keyboard access?

Can you post some sample code that triggers this exception?  What BlackBerry device software version are users seeing on?  You can find this under Options, About on the BlackBerry Smartphone.

 

You may need to run the BlackBerry smartphone simulator in secure mode to reproduce this exception.  Here are the steps to do so in Eclipse.

 

1.  Clean the simulator.

2.  Open the Run or Debug configuration for your project.

3.  Click on the Simulator tab.

4.  Check off "Enable Device Security" (on the general tab).

5.  Run or Debug your application.

 

Note that enabling device security means you'll need to sign your application before running it in the simulator.

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
shea08
Posts: 121
Registered: ‎03-25-2009
My Device: Z30

Re: Bug with file picker? Unauthorized keyboard access?



Mark,

 

I  have tried running my app with security enabled, but the bug is still not triggered, on any of the emulators I have run, including the 8530, where at least one of my customers is seeing the problem. I have also can not duplicate the problem on my 9700 running 5.0.0.545, nor on any of my 6.0 and 7.0 devices.

 

I have requested the exact OS version my 8530 customer is using.

 

Below is pretty much exactly what I am doing. I can't confirm that this duplicates the bug, because I have no way of testing that.  I have emailed my customer asking if they will try this test app and see if it triggers the bug for them.

 

package testpackage;

import net.rim.device.api.ui.UiApplication;

/**
 * This class extends the UiApplication class, providing a graphical user interface.
 */
public class FilePickerTest extends UiApplication {
    /**
     * Entry point for application
     * 
     * @param args
     *            Command line arguments (not used)
     */
    public static void main( String[] args ) {
        // Create a new instance of the application and make the currently
        // running thread the application's event dispatch thread.
        FilePickerTest theApp = new FilePickerTest();
        theApp.enterEventDispatcher();
    }

    /**
     * Creates a new FilePickerTest object
     */
    public FilePickerTest() {
        // Push a screen onto the UI stack for rendering.
        pushScreen( new MyMainScreen() );
    }
}
package testpackage;

import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.FieldChangeListener;
import net.rim.device.api.ui.component.BasicEditField;
import net.rim.device.api.ui.component.ButtonField;
import net.rim.device.api.ui.component.EditField;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.ui.picker.FilePicker;

public class MyMainScreen extends MainScreen {
    private final BasicEditField basicEditField;

    public MyMainScreen() {
        super( MainScreen.VERTICAL_SCROLL | MainScreen.VERTICAL_SCROLLBAR );
        setTitle( "Keyboard Access Violation Test" );

        basicEditField = new EditField("File:", "");
        add( basicEditField );

        ButtonField buttonField_1 = new ButtonField( "Select File", ButtonField.CONSUME_CLICK | ButtonField.FIELD_RIGHT );
        add( buttonField_1 );
        buttonField_1.setChangeListener( new FieldChangeListener() {
            public void fieldChanged( Field arg0, int arg1 ) {
            	final FilePicker fp = FilePicker.getInstance();
            	final String path = fp.show();
            	if( path != null && path.length() > 0 )
            	{
            		basicEditField.setText(path);
            	}
            }
        } );
    }
}

 

 I will post back when/if  I hear back from my customer.

Please use plain text.
Developer
shea08
Posts: 121
Registered: ‎03-25-2009
My Device: Z30

Re: Bug with file picker? Unauthorized keyboard access?

Ok. I can now confirm that code I posted abve does in fact reproduce the bug for my customer.  My customer is running firware: 5.0.0.386 (platform 4.2.0.160).

 

Is this a known bug? I am not sure if I can tell my customer to upgrade their firmware, I don't want to be responsible if they botch that.  So re-write file picker it is?

 

~S

Please use plain text.
BlackBerry Development Advisor
MSohm
Posts: 14,677
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook

Re: Bug with file picker? Unauthorized keyboard access?

It looks like an issue with the OS.  There were problems with FilePicker in 5.0.  If you are looking to create your own, have a look at this sample:

 

Create a file selection popup screen

http://supportforums.blackberry.com/t5/Java-Development/Create-a-file-selection-popup-screen/ta-p/44...

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
shea08
Posts: 121
Registered: ‎03-25-2009
My Device: Z30

Re: Bug with file picker? Unauthorized keyboard access?

Thanks for a conclusion.  I have actually already written my own picker for 4.x devices, it isn't as pretty as the stock one, so I'll just give uses the option of enabling my fugly one.

 

Cheers.

Please use plain text.