2012-06-26 51 views
0

我嘗試製作alertdialog,以便在單擊時顯示另一個活動,但這不起作用。這裏是我的代碼:如何使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(); 
} 

我真的很需要幫助。非常感謝你:)

+0

[Rü試圖顯示彈出? –

+0

你想要做的事情並不清楚你的問題 –

回答

1
Dialog d = new Dialog(this); 
d.setContentView(R.layout.your_layout); 
d.show(); 

在哪裏,這是引用喲你的活動

相關問題