title: AlertDialog inside spinner setOnItemSelectedListener
body: <p>Is it possible to create warning message when spinner item is changed but in case user click's No 
  selection should be canceled and selected item should stay as it was previously. If I store last selected spinner item and pass it to spinner when user chooses No
  it will tirger onItemSelectedListener which i don't want to.</p>
  
  <p>I tried to use OnTouchListener but this doesn't help because spinner list is displayed imidiately after spinner is touched.</p>
  
  <p>See my code below for better understanding.</p>
  
  <p><code></p>
  
  <pre><code>    spinnerSearch.setOnItemSelectedListener(new OnItemSelectedListener() {
  
          @Override
          public void onItemSelected(AdapterView&lt;?&gt; parentView, View selectedItemView, final int position, long id) {
  
              if (!ShoppingCart.isEmpty()) {
                  AlertDialog.Builder dialog = new AlertDialog.Builder(SearchProductActivity.this);
                  dialog.setMessage("Selecting new finacier will empty your basket.").setCancelable(false).setPositiveButton("Yes", new DialogInterface.OnClickListener() {
  
                      public void onClick(DialogInterface dialog, int which) {
                          dialog.dismiss();
                          //do some work
                          //storing lastSelectedFinancier
                      }
  
                  }).setNegativeButton("No", new DialogInterface.OnClickListener() {
  
                      public void onClick(DialogInterface dialog, int which) {
  
                          dialog.dismiss();
                          //cancel selection
                          //spinnerSearch.setSelection(lastSelectedFinancier)
  
                      }
  
                  });
  
                  AlertDialog alert = dialog.show();
  
                  TextView messageView = (TextView) alert.findViewById(android.R.id.message);
                  messageView.setGravity(Gravity.CENTER);
              } else {
                  //do some other work
                  //lastSelectedFinancier
              }
  
          }
  
          @Override
          public void onNothingSelected(AdapterView&lt;?&gt; arg0) {
              // TODO Auto-generated method stub
  
          }
  
          //lastSelectedFinancier
  
      });
  </code></pre>
  
  <p></code></p>