I am building a Login page for my app. I have two EditText fields and a Button. When the app is launched, clicking on the button the first time provides no response,logcate is also not showing anyting, but when clicked the second time, it works. I don't know what is happening. Please help me.
activity_login.xml
<Button android:id="@+id/buttonLogin" style="@style/Button1" android:onClick="onLoginClick" android:text="continue" /> LoginActivity.java
buttonLogin= (Button) findViewById(R.id.buttonLogin); buttonLogin.setFocusable(true); buttonLogin.setFocusableInTouchMode(true); buttonLogin.requestFocus(); buttonLogin.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { hideSoftKeyboard(LoginActivity.this, v); Log.d("helo", "heoolll"); String username = mUserEditText.getText().toString(); String password = mPassEditText.getText().toString(); String location = mLocationData.get(mLocationSpinner.getSelectedItemPosition()).toLowerCase(); if(username.isEmpty()||password.isEmpty()){ //CreatorMessenger.getInstance().showMessage(this,"Error!!","You need to enter username and password both to continue!!"); popbox(); return; } /*buttonLogin.requestFocus(); buttonLogin.setFocusableInTouchMode(true);*/ User user; user = new User(username); user.setLocation(location); AppManager.getInstance().setLoggedInUser(user); APICaller.getInstance().login(username, password, location); } }); }