views:

188

answers:

1

Hello,

I want to show the Android version of a Model Dialog with text input however I think the keyboard will be behind the actual activity since dialogs weren't made to have inputs. Is there any way I can get the keyboard to show in an actual dialog.

I did see this SO question -- however I'd rather not use an Theme.Dialog'ed activity because I feel like an activity would be too heavy for my purposes. How can I show this Model Dialog with the keyboard input in the foreground?

This is what I am talking about: alt text

+2  A: 

Who said dialogs aren't made to have inputs?! A dialog can contain anything - text, buttons, progress bars, input fields. Did you try it out? A keyboard resizes your canvas, so there's no "behind"/"front" going on. (Besides, you can always summon the IME on a phone without a QWERTY keyboard by holding the menu button - even there's a modAl dialog.)

EDIT: If you need proof, just look at the API Demos (App -> Dialog). There's an example for a dialog with text entry. Source code here: http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/app/AlertDialogSamples.html (DIALOG_TEXT_ENTRY)

EboMike
I updated my previous question with a picture that shows where I saw this.
hwrdprkns
Well, yeah, that's a system dialog about the IME. But your app won't look like that. Look at the API Demos in the Google SDK - Check out App -> Dialog -> Text Entry dialog. There's a simple example for what you're trying to do.
EboMike
Can you link me or post the code in your answer -- I don't see the file you are talking about. Also if you post the code in your answer it will benefit others.
hwrdprkns
The API demos are on your local hard disk. You got them when you installed the SDK. I'll edit the answer for more details.
EboMike
Thanks -- I saw that. Exactly the answer I'm looking for.
hwrdprkns