我尝试制作 alertdialog 以便单击时会显示另一个活动,但这不起作用。这是我的代码:
protected void onListItemClick(ListView l, View v, int position, long id) {
final Entity_Brand brand = adapterBrand.getItem(position);
CharSequence[] items = { "Cross Country(XC)", "All Mountain(AM)",
"Free Ride(FR)", "DownHill(DH)", "DirtJump(DJ)", "Road Bike" };
AlertDialog.Builder builder = new AlertDialog.Builder(
Brand_ListView_Activity.this);
builder.setIcon(R.drawable.icon_alert);
builder.setTitle(brand.getNama_brand());
builder.setItems(items, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int item) {
switch (item) {
case 0:
Toast.makeText(Brand_ListView_Activity.this,
R.layout.test, Toast.LENGTH_LONG).show();
break;
}
}
});
AlertDialog alert = builder.create();
alert.show();
}
我真的很需要帮助。太感谢了 :)