I currently display my search results by setListAdapter. I want to display this in a dialog and cannot figure out how. Here is the code I use to create my adapter:
setListAdapter(new ArrayAdapter(getActivity(), R.layout.location_entry, WeatherData.getSingleton(getActivity().getApplication()).getLocNames()));
Is there any way to insert this into a dialog and still have the results clickable?
isn't it like you can make a list in the dialog by some build in functions? You could just pass the object to the dielog and iterate through to create a list Or you can always add a view, like an adapter view
final CharSequence[] items = {"Red", "Green", "Blue"};
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Pick a color");
builder.setItems(items, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int item) {
Toast.makeText(getApplicationContext(), items[item], Toast.LENGTH_SHORT).show();
}
});
AlertDialog alert = builder.create();
or
builder = new AlertDialog.Builder(mContext);
builder.setView(layout); // YOur view goes here
alertDialog = builder.create();