i have a Listview which displays list of clients, i have added an onClickListner to Listview so that i can get the detailed information of clicked client.
Li
Use ths code:
l.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView> arg0, View arg1, int arg2,
long arg3) {
// TODO Auto-generated method stub
ClientListView j = JList.get(position);
String mess = "you clicked position " + position + " With Name " + j.GetClientName();
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(ActivityName.this);//Your activity name
// set title
alertDialogBuilder.setTitle("Hello!");
// set dialog message
alertDialogBuilder.setMessage(mess)
.setCancelable(false)
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
// if this button is clicked, close
// current activity
}
});
// create alert dialog
AlertDialog alertDialog = alertDialogBuilder.create();
// show it
alertDialog.show();
}
});
Hope this will work..