I'm having a hard time figuring out how to getText()
as a readable String from a inflated EditText
.
I have a boolean method that checks something, so, in the onCreate method i call it like this
if(method) {
if(booleanVariable) {
LayoutInflater factory = LayoutInflater.from(MyActivity.this);
View child = factory.inflate(R.layout.password, null);
mPassword = (EditText)child.findViewById(R.id.password);
}
}
Then thats the part where i try to retrieve the text:
private View.OnClickListener btnLoginListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
if(mPassword!=null) {
if(mPassword.getText().toString()==password) {
// LOGIN OK
} else {
// NOT OK
}
}
}
Result:
07-11 15:39:53.098: VERBOSE/Project(1239): mPassword: <b>android.widget.EditText@43d3ba98</b> password: 329349