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

Android™ Development

Reply
New Contributor
Posts: 4
Registered: ‎06-11-2013
My Device: z10
My Carrier: --

showing virtual keyboard through code is crashing the VM

Hi,

My app used to work on the z10 device until the latest OS upgrade, I am trying to manually show the virtual keyboard and for some unknown reason this causes the app to stop working it freezes the whole device, this same app works just fine on all android versions, I have no idea what could cause this, any help on the subject would be appreciated.

 

(The app was created using the open-source project CodenameOne and the apk was converted using the command line tools.)

 

New Contributor
Posts: 4
Registered: ‎06-11-2013
My Device: z10
My Carrier: --

Re: showing virtual keyboard through code is crashing the VM

no one... how should I debug such crash, besides if I am able to crash the vm from a java code isn't this something you will be interested to know/fix?

 

Retired
Posts: 264
Registered: ‎01-08-2013
My Device: BlackBerry 10 Dev Alpha B
My Carrier: Bell

Re: showing virtual keyboard through code is crashing the VM

1) What OS build are you using?

2) What code are you using to pop up the keyboard?

3) Does this open source progject use native libs?

 

    Justin

 

Justin Jasmann | Android Application Development Consultant
Developer Relations
developer.blackberry.com
New Contributor
Posts: 4
Registered: ‎06-11-2013
My Device: z10
My Carrier: --

Re: showing virtual keyboard through code is crashing the VM

1)I am using the latest simulator version 10.1.0.1483 

 

2)The code is slghtly big, but this is the virtual keboard relevant poping code which I assum causes the issue, but I'm not sure because the vm hangs:

 

private void showVirtualKeyboard(boolean show) {
Log.i(TAG, "showVirtualKeyboard show=" + show);

boolean result;
if (show) {
// If we're in landscape, Android will not show the soft
// keyboard unless SHOW_FORCED is requested
Configuration config = mResources.getConfiguration();

boolean isLandscape = (config.orientation == Configuration.ORIENTATION_LANDSCAPE);
int showFlags = isLandscape ? InputMethodManager.SHOW_FORCED : InputMethodManager.SHOW_IMPLICIT;

mInputManager.restartInput(mEditText);
result = mInputManager.showSoftInput(mEditText, showFlags, mResultReceiver);
} else {
result = mInputManager.hideSoftInputFromWindow(mEditText.getWindowToken(), 0, mResultReceiver);
}

Log.d(TAG, "InputMethodManager returned " + Boolean.toString(result).toUpperCase());
}

 

 

3) No, Just the Android API.

Retired
Posts: 140
Registered: ‎04-19-2013
My Device: BlackBerry Z10

Re: showing virtual keyboard through code is crashing the VM

[ Edited ]

Let me give it a shot ...

 

(On an actual device ... I'm unfamiliar with the simulator, perhaps that could be the issue).

Highlighted
Retired
Posts: 264
Registered: ‎01-08-2013
My Device: BlackBerry 10 Dev Alpha B
My Carrier: Bell

Re: showing virtual keyboard through code is crashing the VM

[ Edited ]

Awesome, thanks for including that.

 

I've tried this on two devices with that OS build and haven't been able to reproduce. Everything works well.

 

One guess is that maybe you are doing something odd in your ResultReceiver, but I can't be sure. 

 

Mine is very simple and looks like: 

 

    final class MyResultReceiver extends ResultReceiver
    {
        public MyResultReceiver(final Handler handler)
        {
            super(handler);
        }
        
        @Override
        public void onReceiveResult(final int resultCode, final Bundle resultData)
        {
            Log.d(TAG, "onReceiveResult()");
        }
    }

 

Edit: Sorry, didn't realize you were on a simulator!

 

    Justin

 

Justin Jasmann | Android Application Development Consultant
Developer Relations
developer.blackberry.com