我想实现AlertDialog.Builder
选定的项目点击事件。以下是我到目前为止所尝试的。我对 Android 很陌生,我不确定如何访问该事件。如何为列表中的每个单独项目实现点击事件?
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
public class MakeCallAlertDialog {
public static AlertDialog.Builder getAlertDialog(String strArray[],
String strTitle, Activity activity) {
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(activity);
alertDialogBuilder.setTitle(strTitle);
alertDialogBuilder.setItems(strArray, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int arg) {
// TODO Auto-generated method stub
}
});
return alertDialogBuilder;
}
}