这个带有edittext的警报框代码在这个m中从用户那里获取值...我想将该值转换为整数n在我的代码中使用..
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setTitle("Enter Your Weight");
alert.setMessage("");
// Set an EditText view to get user input
final EditText input = new EditText(this);
alert.setView(input);
alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
Editable value = input.getText();
Toast.makeText(getApplicationContext(), "Weight is..."+value, Toast.LENGTH_LONG).show();
// Do something with value!
}
});
alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
// Canceled.
}
});
alert.show();