[android-developers] SearchView as part of the AlertDialog
Hi All,
I am trying to place the search widget [SearchView basically] in the
title part of an AlertDialog. Is that allowed i.e will it work? The
idea is to have the user enter a search word and when he/she presses
the "Enter" key on the keyboard, to use the search word entered to
search through an array of strings and display the result as a
listView in the same AlertDialog's body portion. The following is the
piece of relevant code.
AlertDialog.Builder dialogBuilder = new
AlertDialog.Builder(MainActivity.this);
RelativeLayout titleLayout = new RelativeLayout(this);
SearchView sv = new SearchView(this);
titleLayout.addView(sv);
dialogBuilder.setCustomTitle(titleLayout);
When i run this code, i see the search widget in the title alright.
The Virtual/Soft keyboard pops up when i click inside the search box -
but i am unable to type in it because the AlertDialog disappears as
soon as i click anywhere outside of it (as it should). I am wondering
if the keyboard is associated with the activity that is launching the
alertdialog instead of being in the context of the AlertDialog itself.
Any ideas?
TIA.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home