title: How to show Alert Dialog when click on listview
body: <p>I want to show alertdialog when I click on a listview on my activity, I have a code to show the alertdialog but I know something wrong with my code and I don't know how to fix it, the alert didn't show like what i want but in DDMS get the result what I want. here's my code :</p>
  
  <pre><code>@Override
  protected void onListItemClick(ListView l, View v, int position, long id) {
  
  new bike_type_dao(responsetype).view_bike_type();
  
  final Entity_Brand brand = adapterBrand.getItem(position);
  
  LayoutInflater li = (LayoutInflater) this
          .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  View view = li.inflate(R.layout.listview_activity, null, false);
  AlertDialog.Builder builder = new AlertDialog.Builder(this);
  builder.setTitle(brand.getBrand_name());
  builder.setView(view);
  
  ListView listtype = (ListView) view.findViewById(R.id.list_sepeda);
  listtype.setOnClickListener((OnClickListener) this);
  listtype.setAdapter(new ArrayAdapter&lt;Entity_Bike_Type&gt;(this,
          android.R.layout.simple_list_item_1, arrayList));
  listtype.setOnItemClickListener((OnItemClickListener) this);
  
  builder.create().show();
  
  }
  </code></pre>
  
  <p>Thanks.</p>
  
  <p>thats my log cat:</p>
  
  <blockquote>
    <p>09-18 11:52:07.819: E/HttpResponse(25866): {"result":1,"data":[{"0":"1","id_brand":"1","1":"Polygon","brand_name":"Polygon"},{"0":"2","id_brand":"2","1":"United Bike","brand_name":"United Bike"},{"0":"3","id_brand":"3","1":"WimCycle","brand_name":"WimCycle"}]}
    09-18 11:52:09.669: D/AndroidRuntime(25866): Shutting down VM
    09-18 11:52:09.669: W/dalvikvm(25866): threadid=1: thread exiting with uncaught exception (group=0x40018578)
    09-18 11:52:09.679: E/AndroidRuntime(25866): FATAL EXCEPTION: main
    09-18 11:52:09.679: E/AndroidRuntime(25866): java.lang.ClassCastException: com.wilis.hellotabwidget.Tab_Brand_ListView_Activity
    09-18 11:52:09.679: E/AndroidRuntime(25866):    at com.wilis.hellotabwidget.Tab_Brand_ListView_Activity.onListItemClick(Tab_Brand_ListView_Activity.java:158)
    09-18 11:52:09.679: E/AndroidRuntime(25866):    at android.app.ListActivity$2.onItemClick(ListActivity.java:319)
    09-18 11:52:09.679: E/AndroidRuntime(25866):    at android.widget.AdapterView.performItemClick(AdapterView.java:284)
    09-18 11:52:09.679: E/AndroidRuntime(25866):    at android.widget.ListView.performItemClick(ListView.java:3755)
    09-18 11:52:09.679: E/AndroidRuntime(25866):    at android.widget.AbsListView$PerformClick.run(AbsListView.java:1964)
    09-18 11:52:09.679: E/AndroidRuntime(25866):    at android.os.Handler.handleCallback(Handler.java:587)
    09-18 11:52:09.679: E/AndroidRuntime(25866):    at android.os.Handler.dispatchMessage(Handler.java:92)
    09-18 11:52:09.679: E/AndroidRuntime(25866):    at android.os.Looper.loop(Looper.java:130)
    09-18 11:52:09.679: E/AndroidRuntime(25866):    at android.app.ActivityThread.main(ActivityThread.java:3687)
    09-18 11:52:09.679: E/AndroidRuntime(25866):    at java.lang.reflect.Method.invokeNative(Native Method)
    09-18 11:52:09.679: E/AndroidRuntime(25866):    at java.lang.reflect.Method.invoke(Method.java:507)
    09-18 11:52:09.679: E/AndroidRuntime(25866):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
    09-18 11:52:09.679: E/AndroidRuntime(25866):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
    09-18 11:52:09.679: E/AndroidRuntime(25866):    at dalvik.system.NativeStart.main(Native Method)
    09-18 11:52:09.809: E/HttpResponse(25866): {"result":1,"data":[{"0":"1","id_type":"1","1":"Cross Country (XC)","type_name":"Cross Country (XC)"},{"0":"2","id_type":"2","1":"BMX","type_name":"BMX"},{"0":"3","id_type":"3","1":"Free Ride (FR)","type_name":"Free Ride (FR)"},{"0":"4","id_type":"4","1":"DownHill (DH)","type_name":"DownHill (DH)"},{"0":"5","id_type":"5","1":"DirtJump (DJ)","type_name":"DirtJump (DJ)"},{"0":"6","id_type":"6","1":"Road Bike","type_name":"Road Bike"}]}</p>
  </blockquote>