1
我在这上面花了很多时间,并且在这个网站上看到很多类似问题的消息,但是我解决不了= [请帮我解决问题android对话框 - edittext总是NULL
public void button() {
button = (Button) findViewById(R.id.hadash);
button.setOnClickListener(new OnClickListener() {
private String newweight2;
@Override
public void onClick(View view) {
final Dialog dialog = new Dialog(Activity3.this);
LayoutInflater inflater = (LayoutInflater) getLayoutInflater();
View content = inflater.inflate(R.layout.dialog, null);
dialog.setContentView(content);
dialog.setTitle("הוספת מעקב משקל");
Button dialogButton = (Button) content.findViewById(R.id.button1);
EditText newweight = (EditText) content.findViewById(R.id.editText1);
newweight2 = newweight.getText().toString();
dialogButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// int newweight2=Integer.parseInt(newweight.getText().toString());
// SQLiteDatabase db;
// db = openOrCreateDatabase("weight.db" , SQLiteDatabase.CREATE_IF_NECESSARY,null);
// String sql = "INSERT INTO weight_listview (weight,date) VALUES(" + newweight + ",'03/04/2014')" ;
// db.execSQL(sql);
Toast.makeText(Activity3.this,"המשקל " + newweight2 + " נקלט בהצלחה", Toast.LENGTH_LONG).show();
dialog.dismiss();
}
});
dialog.show();
}
});
}
请帮助= [我真的筋疲力尽
toda raba :)谢谢你 – Alona