Adapterを使ったSIngleChoiceDialog

public class AlertDialogSingleChoice extends Activity {
    String[] ar = { "red", "green", "bule", "white" , "apple" };
    ArrayAdapter<Location> adapter;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        adapter = new ArrayAdapter<AlertDialogSingleChoice.Location>(this, android.R.layout.select_dialog_singlechoice);
        
        int i =0;
        for(String s : ar){
            adapter.add(new Location(s, i+ 1.1f, i+ 1.2f));
            i++;
        }
       
    }

    public void onClickButton(View v) {
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle("Title");
        builder.setSingleChoiceItems(adapter, 0, new OnClickListener() {
            
            @Override
            public void onClick(DialogInterface dialog, int which) {
                Toast.makeText(AlertDialogSingleChoice.this, adapter.getItem(which).name + ":" + adapter.getItem(which).lat, Toast.LENGTH_SHORT).show();
                dialog.dismiss();
                
            }
        });
        builder.show();
    }
    
    class Location{
        String name;
        float lat;
        float lng;
        public Location(String name, float lat, float lng) {
            super();
            this.name = name;
            this.lat = lat;
            this.lng = lng;
        }
        
        @Override
        public String toString() {
            return name;
        }
    }
}