Q:

How do I make an alert dialog display items in a string by position in Java?

I am making an application where the user sees a list of words in a ListView, and can click on them for a translation. What I want is to see English words in the list, and the alert dialog brings up some jibberish (I will later change the jibberish into Spanish definitions). 
Right now, I have both strings in order so when you click the first word in the list, the alert will contain the first word of the second set of strings. When you click on the second word in the list, I want the second word of the second string to show up in the alert. When you click on the third word in the list, I want the third word of the second string to show up in the alert. My only problem is, that the alert wont show the corresponding item from the second string. The alert is only showing the same word that was clicked on in the list. 
I realize that I could make an activity for each and every word, but that seemed like a hassle, so I decided to use an alert dialog.
Can someone update my code to show me how I can make the words from the second string appear in the alert?
This is my code: 
import android.app.AlertDialog;
import android.app.ListActivity;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class SpanishActivity extends ListActivity {

 static final String[] basicWords = new String[] {
   "Hello", "Goodbye", "Yes", "No", 
   "Why", "Where", "When", "What ", "Who", "How", "Absolutely", "I", "You",
   "He", "She", "That", "Black", "White", "Red","Orange", "Blue", "Green",
   "Yellow", "Purple", "Later" , "Now", "Today", "Tomorrow", "Left", "Right",
   "Hand", "Mouth", "Tongue", "Nose", "Ear", "Eyes", "Leg", "Dog", "Cat", 
   "Elephant", "Snake", "Camel", "Pen", "Pencil", "Book", "Paper", "Hot",
   "Cold", "Airplane", "Car", "Raining", "Sunny", "Cloudy", "Water", "Please",
   "Help", "Work", "English", "America", "England", "Funny", "Thanks", 
   "Good", "Bad", "Happy", "Sad", 
   };

 String[] spanishBasic = new String[]{
     "afsdfb", "qerg", "nt4th", "erhn", 

       "ehrethn", "rth", "Kub", "ygfd ", "cvb", "ytrfvh", "jhgv", "Mvbay",         "hgfv",

       "gv", "cvbnhg", "gfd", "hgf", "ytr", "hgf","wthw", "wetergh",     "wewrth",

       "weth", "erg", "wrgwr" , "dfghj", "xdhtcjfy", "cfj", "zsrxdtcf", "oiuy",

       "rxjtdcfky", "n", "dfgh", "sdfgh", "fgbh", "nkhn", "ayr", "ota",     "dfgh", 

       "Hafghi", "ghjnp", "Ogtyh", "dfg", "fghn", "fghjnm", "ghn", "hjk",

       "xdcfgh", "xcv", "hjdi", "fghish", "fghoop", "Bhjl", "bnani", "cvbn",

       "Mghj", "bhjam", "hjayzi", "ghjk", "vhj", "vghj", "cfgh", 

       "bhj", "bhjra", "ghjshi", "fghhum",   

 };

   /** Called when the activity is first created. */

 @Override
   public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setListAdapter(new ArrayAdapter<String>(this,
               android.R.layout.simple_list_item_1, basicWords));
       getListView().setTextFilterEnabled(true);
   }

 @Override
 protected void onListItemClick(ListView l, View v, int position, long id) {
  // TODO Auto-generated method stub
  super.onListItemClick(l, v, position, id);

  new AlertDialog.Builder(this)
   .setTitle("Spanish")
   .setMessage("" + getListView().getItemAtPosition(position))
   .setPositiveButton("Back to List",
     new DialogInterface.OnClickListener() {
      public void onClick(DialogInterface dialog, int which) {}}
     )
   .show();

 }

}

A:

you have completed almost what you require.
use 
.setMessage("" + spanishBasic[position])

in place of 
.setMessage("" + getListView().getItemAtPosition(position))

my code is here
 public class SpanishActivity extends ListActivity {

 static final String[] basicWords = new String[] {
   "Hello", "Goodbye", "Yes", "No", 
   "Why", "Where", "When", "What ", "Who", "How", "Absolutely", "I", "You",
   "He", "She", "That", "Black", "White", "Red","Orange", "Blue", "Green",
   "Yellow", "Purple", "Later" , "Now", "Today", "Tomorrow", "Left", "Right",
   "Hand", "Mouth", "Tongue", "Nose", "Ear", "Eyes", "Leg", "Dog", "Cat", 
   "Elephant", "Snake", "Camel", "Pen", "Pencil", "Book", "Paper", "Hot",
   "Cold", "Airplane", "Car", "Raining", "Sunny", "Cloudy", "Water", "Please",
   "Help", "Work", "English", "America", "England", "Funny", "Thanks", 
   "Good", "Bad", "Happy", "Sad", 
   };

 String[] spanishBasic = new String[]{
     "afsdfb", "qerg", "nt4th", "erhn", 

       "ehrethn", "rth", "Kub", "ygfd ", "cvb", "ytrfvh", "jhgv", "Mvbay",         "hgfv",

       "gv", "cvbnhg", "gfd", "hgf", "ytr", "hgf","wthw", "wetergh",     "wewrth",

       "weth", "erg", "wrgwr" , "dfghj", "xdhtcjfy", "cfj", "zsrxdtcf", "oiuy",

       "rxjtdcfky", "n", "dfgh", "sdfgh", "fgbh", "nkhn", "ayr", "ota",     "dfgh", 

       "Hafghi", "ghjnp", "Ogtyh", "dfg", "fghn", "fghjnm", "ghn", "hjk",

       "xdcfgh", "xcv", "hjdi", "fghish", "fghoop", "Bhjl", "bnani", "cvbn",

       "Mghj", "bhjam", "hjayzi", "ghjk", "vhj", "vghj", "cfgh", 

       "bhj", "bhjra", "ghjshi", "fghhum",   

 };

   /** Called when the activity is first created. */

   public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setListAdapter(new ArrayAdapter<String>(this,
               android.R.layout.simple_list_item_1, basicWords));
       getListView().setTextFilterEnabled(true);
   }

 protected void onListItemClick(ListView l, View v, int position, long id) {
  // TODO Auto-generated method stub
  super.onListItemClick(l, v, position, id);

  new AlertDialog.Builder(this)
   .setTitle("Spanish")
   .setMessage("" + spanishBasic[position])
   .setPositiveButton("Back to List",
     new DialogInterface.OnClickListener() {
      public void onClick(DialogInterface dialog, int which) {}}
     )
   .show();

 }

}

Good luck and have a nice day..

