我需要一些帮助才能AlertDialog
从我的应用程序中运行。当有一些错误时它不会编译。尤其是在alertDialog.setItems(items, new DialogInterface.OnClickListener()
与setItems()
.
请看一下。
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_nastavenie_casu);
// Show the Up button in the action bar.
getActionBar().setDisplayHomeAsUpEnabled(true);
final CharSequence[] items = {"30 minút", "45 minút", "60 minút", "75 minút", "90 minút"};
Button tlacidlo = (Button) findViewById(R.id.spusti);
EditText pripomienka = (EditText) findViewById(R.id.upozornit_za);
pripomienka.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
// Intent myIntent = new Intent(view.getContext(), agones.class);
// startActivityForResult(myIntent, 0);
AlertDialog alertDialog = new AlertDialog.Builder(NastavenieCasu.this).create(); //Read Update
alertDialog.setTitle("hi");
alertDialog.setItems(items, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// do something
}
alertDialog.show();
});
}
}
}