0

The code that I am using to suppress the softkeyboard from appearing works about half the time. Any ideas why and how to go about fixing it. Here is my code.

public void time(View v) {
    InputMethodManager imm = (InputMethodManager) getSystemService(Conte xt.INPUT_METHOD_SERVICE);
    imm.hideSoftInputFromWindow(time.getWindowToken(), 0);


    time.setVisibility(View.VISIBLE);
    new TimePickerDialog(report.this, t,
            dateAndTime.get(Calendar.HOUR_OF_DAY),
            dateAndTime.get(Calendar.MINUTE), true).show();
}

I got it to work by adding

   date.setInputType(0);
   time.setInputType(0);

in the Oncreate area. However now it does not always respond to the first tap on the edittext box. Is this an problem only on the emulator?

Aaron
  • 4,042
  • 14
  • 76
  • 131
  • http://stackoverflow.com/questions/1845285/how-to-block-virtual-keyboard-while-clicking-on-edittext-in-android – Sergey Benner Jan 27 '12 at 01:07
  • Thanks, the problem I am having is that the edittext box needs to be double clicked for the dateAndTime to work. – Aaron Jan 27 '12 at 01:14
  • read this one http://stackoverflow.com/questions/8977436/listview-items-focus-behaviour - I've written something similar to that. it might give you the hint. – Sergey Benner Jan 27 '12 at 01:18
  • thanks, adding android:focusableInTouchMode="false" to the XML worked – Aaron Jan 27 '12 at 01:50

0 Answers0