How to dismiss the single select dialog in AlertDialog

by vincent Kor » Sat, 14 Mar 2009 15:58:44 GMT


Sponsored Links
 Hi, All:

    from the reference of SDK,  AlertDialog information as below.

    I want to create a dialog but i don't want to have any buttons in the
dialog, then i hope to dismiss the dialog after i click any item in the
dialog,  how should i dismiss the dialog ?

    When the user click the "back" button, it will dismiss the dialog.  so i
need to send the key message in hard code ? is there any other way??

Thanks a lot for your help.

Vincent


----------------------------------
 public 
AlertDialog.Builder< http://developer.android.com/reference/android/app/AlertDialog.Builder.html> ;
setSingleChoiceItems
(CharSequence[]< http://developer.android.com/reference/java/lang/CharSequence.html> ;items,
int checkedItem,
DialogInterface.OnClickListener< http://developer.android.com/reference/android/content/DialogInterface.OnClickListener.html> ;listener)

Set a list of items to be displayed in the dialog as the content, you will
be notified of the selected item via the supplied listener. The list will
have a check mark displayed to the right of the text for the checked item.
Clicking on an item in the list will not dismiss the dialog. Clicking on a
button will dismiss the dialog.
 Parameters    items the items to be displayed. checkedItem specifies which
item is checked. If -1 no items are checked. listener

notified when an item on the list is clicked. The dialog will not be
dismissed when an item is clicked. It will only be dismissed if clicked on a
button, *if no buttons are supplied it's up to the user to dismiss the
dialog. *

**

-----------------

--~--~---------~--~----~------------~-------~--~----~



How to dismiss the single select dialog in AlertDialog

by Jean-Baptiste Queru » Sat, 14 Mar 2009 16:03:52 GMT


 For the second time, please don't cross-post, and please stay on
topic. This is a question for the android-developers group.

Thanks,
JBQ






-- 
Jean-Baptiste M. "JBQ" Queru
Android Engineer, Google.

Questions sent directly to me that have no reason for being private
will likely get ignored or forwarded to a public forum with no further
warning.

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


How to dismiss the single select dialog in AlertDialog

by vincent Kor » Sun, 15 Mar 2009 00:11:43 GMT


 Thanks for your reminding me of that. JBQ.


 Hi, All:

    from the reference of SDK,  AlertDialog information as below.

    I want to create a dialog but i don't want to have any buttons in the
dialog, then i hope to dismiss the dialog after i click any item in the
dialog,  how should i dismiss the dialog ?

    When the user click the "back" button, it will dismiss the dialog.  so i
need to send the key message in hard code ? is there any other way??

Thanks a lot for your help.

Vincent


----------------------------------
 public 
AlertDialog.Builder< http://developer.android.com/reference/android/app/AlertDialog.Builder.html> ;
setSingleChoiceItems
(CharSequence[]< http://developer.android.com/reference/java/lang/CharSequence.html> ;items,
int checkedItem,
DialogInterface.OnClickListener< http://developer.android.com/reference/android/content/DialogInterface.OnClickListener.html> ;listener)

Set a list of items to be displayed in the dialog as the content, you will
be notified of the selected item via the supplied listener. The list will
have a check mark displayed to the right of the text for the checked item.
Clicking on an item in the list will not dismiss the dialog. Clicking on a
button will dismiss the dialog.
 Parameters     items the items to be displayed. checkedItem specifies which
item is checked. If -1 no items are checked. listener

notified when an item on the list is clicked. The dialog will not be
dismissed when an item is clicked. It will only be dismissed if clicked on a
button, *if no buttons are supplied it's up to the user to dismiss the
dialog. *

**

--~--~---------~--~----~------------~-------~--~----~



How to dismiss the single select dialog in AlertDialog

by vincent Kor » Sun, 15 Mar 2009 00:47:11 GMT


 Hi, All:

    from the reference of SDK,  AlertDialog information as below.

    I want to create a dialog but i don't want to have any buttons in the
dialog, then i hope to dismiss the dialog after i click any item in the
dialog,  how should i dismiss the dialog ?

    When the user click the "back" button, it will dismiss the dialog.  so i
need to send the key message in hard code ? is there any other way??

Thanks a lot for your help.

Vincent


----------------------------------
 public 
AlertDialog.Builder< http://developer.android.com/reference/android/app/AlertDialog.Builder.html> ;
setSingleChoiceItems
(CharSequence[]< http://developer.android.com/reference/java/lang/CharSequence.html> ;items,
int checkedItem,
DialogInterface.OnClickListener< http://developer.android.com/reference/android/content/DialogInterface.OnClickListener.html> ;listener)

Set a list of items to be displayed in the dialog as the content, you will
be notified of the selected item via the supplied listener. The list will
have a check mark displayed to the right of the text for the checked item.
Clicking on an item in the list will not dismiss the dialog. Clicking on a
button will dismiss the dialog.
 Parameters    items the items to be displayed. checkedItem specifies which
item is checked. If -1 no items are checked. listener

notified when an item on the list is clicked. The dialog will not be
dismissed when an item is clicked. It will only be dismissed if clicked on a
button, *if no buttons are supplied it's up to the user to dismiss the
dialog. *

**

-----------------

--~--~---------~--~----~------------~-------~--~----~



How to dismiss the single select dialog in AlertDialog

by Gesh » Sun, 15 Mar 2009 13:12:39 GMT


 from what i can gather what you are looking for is the .setItems()
method, not the setSingleChoiceItems()




--~--~---------~--~----~------------~-------~--~----~



How to dismiss the single select dialog in AlertDialog

by Mercury » Sun, 15 Mar 2009 13:13:01 GMT


 Hi Vincent

you can try to comment button founction and use functions as
following

boolean           onKeyDown(int keyCode, KeyEvent event)
A key was pressed down.
boolean         onKeyUp(int keyCode, KeyEvent event)
A key was released.

you could choice one of them and then add following code into it

new DialogInterface.OnClickListener() {
                 public void onClick(DialogInterface dialog, int whichButton) {
                 setResult(RESULT_OK);
                 finish();
                 }
                 }

Maybe can help you.

Best regards and good luck!

Mercury





--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Is there any UI can connect to SQLite database?

Use SQLite Manager which is a Firefox plugin. You can easily pull DBs
from your device and display DBs with the plugin and also do
modification. Furthermore when you need to find out about how to
implement queries you can verify your SQLite query with the SQLite
Manager.


--
Roman Baumgaertner
Sr. SW Engineer-OSDC
T  Mobile stick together
The views, opinions and statements in this email are those of the
author solely in their individual capacity, and do not necessarily
represent those of T-Mobile USA, Inc.



--~--~---------~--~----~------------~-------~--~----~

2. Phone.apk not working with TTS_library_stub

Hi,

I have added TTS_library_stub to Phone(Android Core Application)
application and used methods of this library.
After building the Phone.apk i installed it in AndroidG1. But Phone
functionality stoppped working.

My doubts are :
1)Can we add a prebuilt static library to Core Application(here
Phone) ?
2)If Yes how to add prebuilt static library ?
3)Can we build and flash Phone.apk indivisually(not along with whole
image) to Android G1 ?

Please anwser

Thanks for your time.

--~--~---------~--~----~------------~-------~--~----~

3. How to add thhp headers in Webview?

4. android-developers - 25 new messages in 16 topics - digest

5. regarding kSOAP web services.

6. How to query the number of unread SMS

7. hybrid peer to peer