May 25 | 7:55 PM |
Mark M. | has entered the room |
Mark M. | turned on guest access |
Mike R. | has entered the room |
Mike R. |
Hi Mark
|
Mark M. |
howdy, Mike!
|
Mike R. |
some questions about the soft keyboard
|
Mark M. |
ok
|
Mike R. |
i have a couple of edittext fields and would like to have a little better control over what goes on in the app with them
|
Mike R. |
for instance, i'd like to know when the user has started typing into them
|
Mark M. |
that may not be easy
|
Mike R. |
i've registered an onKey listener but that doesn't work with regular keys
|
May 25 | 8:00 PM |
Mike R. |
is there some way to programmatically dismiss the keyboard?
|
Mark M. |
yes...hold on...
|
Mark M. |
There is hideSoftInputWindow() on InputMethodManager
|
Mark M. |
however, I don't know where to get the IBinder first parameter
|
Mark M. |
oh, sorry -- hideSoftInputFromWindow()
|
Mike R. |
how do I get an inputmethodmanager?
|
Mark M. |
it's a system service -- getSystemService()
|
Mike R. |
is this covered in any of the books?
|
Mark M. |
no
|
Mark M. |
in part, I don't recommend doing it
|
Mike R. |
why
|
Mark M. |
1. spontaneously causing the soft keyboard to go away will piss off users
|
Mark M. |
2. preventing people without hardware keyboards from typing will piss off users
|
Mark M. |
whatever your business problem is, hopefully there is another solution
|
Mike R. |
it's not spontaneous. it would happen when they press a button and a process starts.
|
Mark M. |
oh, sorry, I thought you were trying to get rid of the keyboard once they started typing, per your first comment
|
May 25 | 8:05 PM |
Mike R. |
no. 2 different problems
|
Mark M. |
they should use the action button, then -- lower right corner
|
Mark M. |
ah, here we are
|
Mark M. |
View paste
|
Mark M. |
(where search is an EditText)
|
Mark M. |
run that when they click the search button
|
Mark M. |
(assuming this is search -- whatever button it is you are worried about)
|
Mark M. |
you can also have the action button rigged for search:
|
Mark M. |
View paste
|
Mike R. |
does this permanently hide the keyboard? do I need to do something to re-enable it?
|
Mark M. |
see the android:imeActionId and android:imeOptions attributes
|
Mark M. |
no, this dismisses the current invocation of the keyboard
|
Mark M. |
it'll come back automatically on the next EditText
|
Mike R. |
that should work then.
|
Mark M. |
you can use setOnEditorActionListener() to find out when they press the action button
|
Mike R. |
ok
|
Mike R. |
back to my original question. Let me state the broader objective.
|
Mike R. |
there are 2 edittext fields and a button on the window
|
May 25 | 8:10 PM |
Mike R. |
i only want the button to be enabled if there are values in both the edit text fields
|
Mike R. |
so, the broader question is, what event can I use to trigger a test of the edit text fields and (possibly) enable the button?
|
Mark M. |
I do not know of a good way to do that
|
Mark M. |
setKeyListener() does not work well with soft keyboards
|
Mike R. |
that's < good
|
Mark M. |
a total hack is to poll the fields every second via postDelayed()
|
Mark M. |
if you know of some activity in Android itself that has this feature, I can try to figure out how they pull it off
|
Mike R. |
i think i'll just leave the button enabled and ignore any presses until the fields have values
|
Mike R. |
just doesn't seem like a great user experience.
|
May 25 | 8:15 PM |
Mike R. |
would putting up a toast be appropriate in this situation?
|
Mark M. |
possibly
|
Mark M. |
it wouldn't cause any true harm
|
Mark M. |
might be distracting
|
Mark M. |
you could try addTextChangedListener()
|
Mark M. |
supply a TextWatcher where your afterTextChanged() sees if the fields are empty
|
Mark M. |
since this isn't tied to "keys", it may work with soft keyboards -- haven't tried it
|
Mike R. |
where do i find the definition of addTextChangeListener?
|
Mark M. |
that is on TextView
|
May 25 | 8:20 PM |
Mike R. |
thanks. found it. i think i'll give that a try.
|
Mike R. |
well, getting close. may have an app before too long.
|
Mike R. |
bye bye for now.
|
Mark M. |
see ya!
|
Mike R. | has left the room |
May 25 | 8:40 PM |
Robert C. | has entered the room |
Mark M. |
howdy, Robert!
|
Robert C. |
hi
|
Robert C. |
Am I really the only one here
|
Mark M. |
right now, yes
|
Mark M. |
somebody was here earlier
|
Robert C. |
cool
|
Robert C. |
A coworker named Casey said he met you at Google I/O
|
Robert C. |
I'm working for TuneWiki. I bought your books so I could get up to speed on the platform quickly.
|
Mark M. |
cool!
|
Robert C. |
I haven't gotten through all of them yet. About half way through the first one.
|
Robert C. |
Do you know if WMA codec is available for Android?
|
Mark M. |
it's licensable by handset makers
|
Mark M. |
not open source
|
Mark M. |
most phones appear to have it, but not all will
|
Robert C. |
I saw it costs about $800k or something about that.
|
Robert C. |
How would I find it on the phones?
|
Mark M. |
yeah, I haven't heard of a price tag
|
Mark M. |
look up their spec sheets online
|
Robert C. |
For example, Nexus One?
|
Mark M. |
doesn't look like it
|
May 25 | 8:45 PM |
Robert C. |
I went here. Is this right?
|
May 25 | 8:45 PM |
Robert C. | |
May 25 | 8:45 PM |
Mark M. |
not terribly shocking
|
May 25 | 8:45 PM |
Mark M. |
yes
|
Mark M. |
WMA isn't in the audio decoders list
|
Robert C. |
I saw that RadioTime was able to play WMA which got me curious.
|
Robert C. |
Ok, I see that now.
|
Robert C. |
I do see AAC, AAC+ though which is nice.
|
Robert C. |
Just to pat you on the back, I like what you have done in supporting Android. Books, chat, mailing lists, etc. Looks like it is working for you.
|
Mark M. |
it keeps me busy
|
Robert C. |
that is good, right?
|
Mark M. |
yes, it's a good sort of busy :-)
|
Robert C. |
Is there a code way to detect what decoders are available?
|
Mark M. |
not that I'm aware of
|
Mark M. |
I have gone looking for it from time to time
|
Mark M. |
seems like an obvious thing, but I haven't run across it yet
|
Mark M. |
a fine question to pose on StackOverflow
|
Robert C. |
I figure it is a C code thing.
|
Robert C. |
Good idea though to use SO.
|
Mark M. |
oh, I'm sure OpenCORE and StageFright know what
|
Mark M. |
er, what's possible
|
Mark M. |
I just don't see where it's surfaced in the SDK
|
May 25 | 8:50 PM |
Robert C. |
I guess over time and lots of requests it will get there.
|
Robert C. |
Well, I don't have too many other questions right now. Once I get through the books and get deeper into the platform I'm sure to have some.
|
Robert C. |
I'd probably hit the forum unless I had some deeper questions.
|
Mark M. |
I try to hold these twice a week, though at different times of the day to cover more geography
|
Mark M. |
StackOverflow is an awesome Android resource right now
|
Mark M. |
better signal-to-noise ratio than the Google Groups
|
Mark M. |
even get the occasional real live Googler
|
Mark M. |
:-)
|
Robert C. |
I'll keep that in mind.
|
Robert C. |
Not sure about the Googler though. :)
|
Mark M. |
just tag your question with 'android'
|
Mark M. |
(sans quotes)
|
Robert C. |
Just looked at DROID.
|
Robert C. | |
Robert C. |
Here is the audio list.
|
Robert C. |
AMR-NB/WB, MP3, WAV, AAC, AAC+, eAAC+, WMA
|
Mark M. |
right
|
Mark M. |
Motorola has seemed to license WMA across the board
|
Mark M. |
HTC has for all I can think of other than the Nexus One
|
Robert C. |
Sounds good to me. I'll have to get one of their phones and give it a try.
|
Mark M. |
not sure about Samsung, Sony Ericsson, LG, etc.
|
Robert C. |
Is there a one stop page for comparing what all the phones have?
|
May 25 | 8:55 PM |
Mark M. |
since there are ~60 phones, not that I'm aware of
|
Robert C. |
Maybe I'll put one together since I need to know who supports what codecs.
|
Mark M. |
might make a good spreadsheet
|
Robert C. |
I think so. I'll need the data anyway. If I make it, I'll link back to ya.
|
Mark M. |
the chat period is coming to a close -- any other questions?
|
Robert C. |
Nope. I think I have my work cut out for a while.
|
Robert C. |
Thanks for the help and keep up the good work.
|
Mark M. |
thanks!
|
Robert C. |
ttyl
|
Mark M. |
c-ya
|
Robert C. | has left the room |
Mark M. | turned off guest access |