Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - How to determine whichButton in DialogInterface.OnClickListe

How to determine whichButton in DialogInterface.OnClickListe

Put your problem here if it does not fit any of the other categories.

How to determine whichButton in DialogInterface.OnClickListe

Postby daveomcgee » Fri Mar 19, 2010 8:02 pm

Hi there,

Could anyone help me? I wish to determine which button has been selected in a dialogue after the "Set" button has been clicked. Thanks!

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.         @Override
  2.  
  3.         public void onCreate(Bundle icicle) {
  4.  
  5.                 super.onCreate(icicle);
  6.  
  7.  
  8.  
  9.                 final String items[] = { "General", "Soccer", "GAA", "Rugby", "Racing" };
  10.  
  11.  
  12.  
  13.                 AlertDialog.Builder ab = new AlertDialog.Builder(SettingsActivity.this);
  14.  
  15.                 ab.setTitle("Set Sports Feed");
  16.  
  17.                 ab.setSingleChoiceItems(items, 0,
  18.  
  19.                                 new DialogInterface.OnClickListener() {
  20.  
  21.                                         public void onClick(DialogInterface dialog, int whichButton) {
  22.  
  23.  
  24.  
  25.                                         }
  26.  
  27.                                 }).setPositiveButton("Set",
  28.  
  29.                                 new DialogInterface.OnClickListener() {
  30.  
  31.                                         public void onClick(DialogInterface dialog, int whichButton) {
  32.  
  33.                                                 if (whichButton == 0) {
  34.  
  35.                                                         setFeedChoice(feedChoice);
  36.  
  37.                                                 } else if (whichButton == 1) {
  38.  
  39.                                                         setFeedChoice(feedSoccer);
  40.  
  41.                                                 } else if (whichButton == 2) {
  42.  
  43.                                                         setFeedChoice(feedGAA);
  44.  
  45.                                                 } else if (whichButton == 3) {
  46.  
  47.                                                         setFeedChoice(feedRugby);
  48.  
  49.                                                 } else if (whichButton == 4) {
  50.  
  51.                                                         setFeedChoice(feedRacing);
  52.  
  53.                                                 } else {
  54.  
  55.                                                         setFeedChoice(null);
  56.  
  57.                                                 }
  58.  
  59.                                                 goHome();
  60.  
  61.                                         }
  62.  
  63.                                 }).setNegativeButton("Cancel",
  64.  
  65.                                 new DialogInterface.OnClickListener() {
  66.  
  67.                                         public void onClick(DialogInterface dialog, int whichButton) {
  68.  
  69.                                                 goHome();
  70.  
  71.                                         }
  72.  
  73.                                 });
  74.  
  75.  
  76.  
  77.                 ab.show();
  78.  
  79.         }
Parsed in 0.015 seconds, using GeSHi 1.0.8.4
daveomcgee
Freshman
Freshman
 
Posts: 2
Joined: Thu Mar 18, 2010 3:35 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 12 guests