Skip to content

Instantly share code, notes, and snippets.

@skatldjs
Created September 8, 2010 14:43
Show Gist options
  • Select an option

  • Save skatldjs/570224 to your computer and use it in GitHub Desktop.

Select an option

Save skatldjs/570224 to your computer and use it in GitHub Desktop.
final CharSequence[] items = {"Red", "Green", "Blue"};
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("리스트 타이틀");
builder.setSingleChoiceItems(items, -1,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int item) {
Toast.makeText(getApplicationContext(), items[item],
Toast.LENGTH_SHORT).show();
}
});
AlertDialog alert = builder.create();
}
@skatldjs

skatldjs commented Sep 8, 2010

Copy link
Copy Markdown
Author

final CharSequence[] items = {"Red", "Green", "Blue"};
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Pick a color");

    builder.setSingleChoiceItems(items, -1, 
                                    new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int item) {
            Toast.makeText(getApplicationContext(), items[item],
            Toast.LENGTH_SHORT).show();
        }
    });
    AlertDialog alert = builder.create();   
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment