我真的需要帮助。我有一个列表视图,列表中有按钮。我想要做的是获取按下按钮的当前列表的值..(id和名称)我有一个myClickHandler,当按下按钮时它会调用这个..
public void myClickHandler(View v){
ListView lvItems = getListView();
String name = null ;
for (int i=0; i<lvItems.getChildCount(); i++)
{
}
AlertDialog alertDialog = new AlertDialog.Builder(
AllProductsActivity.this).create();
alertDialog.setTitle("Alert Dialog");
alertDialog.setMessage("You have selected "+ name);
alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
Toast.makeText(getApplicationContext(), "You clicked on OK", Toast.LENGTH_SHORT).show();
}
});
并将显示一些带有给定详细信息的alertDialog ..
非常感谢任何愿意帮助我的人..