Skip to content

Instantly share code, notes, and snippets.

Created March 14, 2014 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/9548128 to your computer and use it in GitHub Desktop.
Save anonymous/9548128 to your computer and use it in GitHub Desktop.
private void createDialog() {
LayoutInflater infl = MainActivity.this.getLayoutInflater();
View dialogView = infl.inflater(R.layout.dialog_layout, null);
List<String> SpinnerArray = new ArrayList<String>();
SpinnerArray.add("what ever it is you want");
SpinnerArray.add("what ever it is you want");
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, SpinnerArray);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
Spinner sp = (Spinner) dialogView.findViewById(R.id.spinner01);
sp.setAdapter(adapter);
AlertDialog.Builder aBuilder = new AlertDialog.Builder(MainActivity.this);
aBuilder.setView(dialogView);
aBuilder.setPositiveButton(...);
aBuilder.setNegativeButton(...);
aBuilder.create().show();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment