Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

[solved] Keyboard Input on Android

edited March 2014 in OpenSesame

Hi there,

I recently started using OpenSesame to program a visual search task for Android. I have a problem with text inputs (for session #, difficulty, etc.) It runs fine on my Mac, but when it runs on Android (Nexus 10) the keyboard buttons never show up. This is strange because the keyboard shows up to get subject number when the experiment loads.

Attached is an image of my form_text_input, as well as the actual code. Any help would be much appreciated (we're on a deadline and this is a huge project!). OpenSesame has been a lifesaver for us so far. Looking forward to implementing it. Thanks!

set rows "1;1;6"
set description "A simple text input form"
set cols "1"
set form_question "Enter starting Difficulty:"
set form_title "Visual Search"
set form_var "response1"
widget 0 0 1 1 label text="[form_title]"
widget 0 1 1 1 label center="no" text="[form_question]"
widget 0 2 1 1 text_input focus="yes" return_accepts="yes" var="[form_var]"

image

Comments

  • edited 12:28PM

    Hi,

    Your script is fine and should pop up the virtual keyboard.

    What exactly happens? Can you see the form on the screen, or does the experiment hang before showing anything? In the latter case, there's probably some problem in the prepare phase of one of the items in the experiment sequence. If the former, then something weird is going on.

    To test whether your device is able to show the virtual keyboard, you can use the following script, which should cause the keyboard to pop up ...

    try:
        import android
        android.show_keyboard()
    except:
        pass
    

    ... and the following script, which should cause the keyboard to pop down ...

    try:
        import android
        android.hide_keyboard()
    except:
        pass
    

    See also:

    But since you mention that the keyboard is visible during the selection of the subject number (which is also simply an OpenSesame form), this is unlikely to be the problem.

    OpenSesame has been a lifesaver for us so far.

    Glad to hear we're saving lives!

    Cheers!
    Sebastiaan

  • edited 12:28PM

    Thanks for the quick response, Sebastian.

    Your script was able to make the keyboard pop up, so no problems there.

    What happens is the "Enter Starting Difficulty" form pops up, flashes "Type here..." very briefly in the box, and then shows a static _ in the box. On my Mac I'm able to enter in numbers with the keyboard and run the rest of the experiment just fine.

    I'm using the legacy back-end. Maybe that's the problem? The droid back-end gives me an ImportError: No module named droid.

    Aldi

  • edited 12:28PM

    I'm using the legacy back-end. Maybe that's the problem? The droid back-end gives me an ImportError: No module named droid.

    Yes, that's definitely (and obviously, I might add!) the problem. If you want to run your experiment on Android, you have to use the droid back-end. If this doesn't work, could you provide the full error message, including what you see in the debug window?

  • edited March 2014

    Ah, of course I should have been using droid! I got confused by the documentation for the Droid back-end, which says "The droid back-end is in most ways identical to the legacy back-end".

    Here is the full error message:

    An unexpected error occurred, which was not caught by OpenSesame. This should not happen! Message:
    <b>No module named droid</b>
    

    Here is what shows up in the debug window

    >>> 
    Traceback (most recent call last):
      File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/libqtopensesame/qtopensesame.py", line 1404, in run_experiment
      File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/libopensesame/experiment.py", line 319, in end
      File "openexp/canvas.pyc", line 55, in close_display
    ImportError: No module named droid
    >>> 
    
  • edited 12:28PM

    It seems like the droid back-end is simply not included with your package of OpenSesame. This maybe because your version of OpenSesame is too old, or because something went wrong during packaging. What package and operating system are you using exactly? If you are not running the latest package, does updating solve the issue?

  • edited 12:28PM

    That did it! I'm unable to test builds with the droid back-end when I'm programming them on my Mac, but as long as I switch to Droid before saving and exporting to my Nexus, it pulls up the keyboard and runs just fine on there.

    Thank you so much for helping me with this, in hindsight, obviously incorrect thing I was doing. Now it's just ironing out a few details with stimulus presentation and we're good to go.

Sign In or Register to comment.