title: Problem with onListItemClick and clicklisteners
body: <p>I am trying to create a onListItemClick which will show to the user a dialog with two options. Each option should call a function to execute a certain action. The error i am getting is:</p>
  
  <p>Cannot refer to a non-final variable position inside an inner class defined in a different method</p>
  
  <pre><code> protected void onListItemClick(ListView l, View v, int position, long id){
   final CharSequence[] items = {"Delete", "Show"};
  
   MyPOI mpoi= myAdapter.getItem(position);
  
   AlertDialog.Builder builder = new AlertDialog.Builder(this);
   builder.setTitle("Pick an option");
   builder.setItems(items, new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int item) {
             if(items[item].equals("Delete")){
                 dbc.deletePOI(position);
             }
          }
      });
  
  
   AlertDialog alert = builder.create();
  
   alert.show();
   super.onListItemClick(l, v, position, id);
   }
  </code></pre>