http://pastebin.com/babqrrqa
Как видно из названия, у меня проблемы с получением текста из EditText.
Мое приложение вылетает при чтении этой строки:
String value = aux.getText (). ToString (); , вероятно, потому что aux.getText () является нулевым, но у меня есть setText ("lol"), в этом методе
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.adicionar:
//Toast.makeText(this, "This is the Toast message", Toast.LENGTH_LONG).show();
final AlertDialog.Builder alert = new AlertDialog.Builder(this);
final EditText input = new EditText(this);
LayoutInflater layoutInflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
LinearLayout dialerLayout = (LinearLayout) layoutInflater.inflate(R.layout.input, null);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.FILL_PARENT);
dialerLayout.setLayoutParams(params);
alert.setView(dialerLayout);
alert.setPositiveButton("Adicionar", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
aux = (EditText)findViewById(R.id.cadeira);
aux.setText("lol");
String value = aux.getText().toString();
//String value2="TESTE";
lista.add(value);
adapter.notifyDataSetChanged();
}
});
alert.setNegativeButton("Cancelar",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
dialog.cancel();
}
});
alert.show();
return true;
default: return super.onOptionsItemSelected(item);
}
}