title: Android - Creating an alert dialog in listview from selected item
body: <p>Ive been struggling to get an alert dialog to pop up when the user clicks an item in the list view. I can do a toast message but cant seem to get an alert dialog to work. I then want to have a button in the alert dialog to allow me to take the item just selected and display it on the next screen where it will be show contact details etc for the one selected. If anyone can give me any insight into any good techniques or tips on how to do this it would be awesome! Im a very new programmer and ive tried everywhere.</p>
  
  <p>Below is my code :</p>
  
  <pre><code>public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
  
          String[] taxi = getResources().getStringArray(R.array.taxi_array);
          setListAdapter(new ArrayAdapter&lt;String&gt;(this, R.layout.listtaxi, taxi));
  
          ListView lv = getListView();
          lv.setTextFilterEnabled(true);
  
       lv.setOnItemClickListener(new OnItemClickListener() {
            public void onItemClick(AdapterView&lt;?&gt; parent, View view,
                int position, long id) {
              // When clicked, show a toast with the TextView text
              Toast.makeText(getApplicationContext(), ((TextView) view).getText(),
                  Toast.LENGTH_LONG).show();
            }
          });
      } 
  }
  </code></pre>
  
  <p>The array is in the strings.xml file.</p>
  
  <p>Any help would be very much appreciated.</p>