0
버튼이있는 TextViewer 활동이 있으며이를 클릭하면 목록이있는 AlertDialog가 팝업됩니다. 나는이 link을 따라 갔지만 작동하지 않습니다 (팝업 없음). 나는 그 상황이 틀렸다는 것을 믿습니다. 당신은 show()
방법을 호출하지 않은사용자 정의 AlertDialog가 표시되지 않습니다.
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.resources);
ImageButton btnlist = (ImageButton)findViewById(R.id.list);
btnlist.setOnClickListener(new View.OnClickListener() {
public void onClick (View v){
if (Vars.bookchapter>1){
final CharSequence[] items = {"Red", "Green", "Blue"};
Context mContext = getBaseContext();
AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
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();
}else{
//Nothing
}
}});
}
}
:(또한 최고의 프로그래머로 일 감사 – OkyDokyman
을. – Cristian