0
I’m getting the following error randomly, IE, gives error sometimes and sometimes not:
Caused by: java.lang.NullPointerException
            at pt.cartuxa.Login.onCreate(Login.java:62)
My line 62 is as follows::
password.setImeActionLabel(getString(R.string.keyboard_enter), KeyEvent.KEYCODE_ENTER);
Complete code:
public class Login  extends Activity {
    EditText username, password;
    Editable user_input, pass_input;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // SETTERS
        username = (EditText) findViewById(R.id.txt_login_user);
        password = (EditText) findViewById(R.id.txt_login_pass);
        // VIEW
        setContentView(R.layout.login_layout);
        // VIEW CONFIGS
        password.setImeActionLabel(getString(R.string.keyboard_enter), KeyEvent.KEYCODE_ENTER);
    }
}
I created line 62 to change the text of the Enter button to "Login" but it turns out that when I run the application, it sometimes initializes correctly and sometimes blocks this line giving the error described above.
How can I avoid that mistake?
Thank you very much, that was exactly the problem
– CIRCLE