Try:
public class PasswordActivity extends Activity{
/*This will store the password temporarily */
private int passcodeString;
private String LOG_TAG="Password_Activity";
EditText passOne;
EditText passTwo;
EditText passThree;
EditText passFour;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.password);
passOne = (EditText) findViewById(R.id.passcodeOne);
passTwo = (EditText) findViewById(R.id.passcodeTwo);
passThree = (EditText) findViewById(R.id.passcodeThree);
passFour = (EditText) findViewById(R.id.passcodeFour);
passOne.addTextChangedListener(new CustomTextWatcher(passOne));
}
private class CustomTextWatcher implements TextWatcher {
private EditText mEditText;
public CustomTextWatcher(EditText e) {
mEditText = e;
}
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
public void afterTextChanged(Editable s) {
Log.d(LOG_TAG, s.toString());
}
}}
You were getting an error because you were trying to use findViewById()
before setContentView()
was called.