I'm trying to move to another activity that I name (RegistroActivity) with a button, but when I try it, it leaves me in the main activity, I did a test passed to other Activitys and if it allows it without problem, I do not know why it does not enter specifically to that activity named "Registroactivity".
This is the Activity where the button is
public class HomeActivity extends AppCompatActivity implements GoogleApiClient.OnConnectionFailedListener {
private GoogleApiClient googleApiClient;
private SignInButton signInButton;
public static final int SIGN_IN_CODE = 777;
Button admin;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
admin= (Button) findViewById(R.id.admin);
admin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(HomeActivity.this, RegistroActivity.class));
}
});
There is the activity that I want to spend
public class RegistroActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_registro);
Button contrasena = (Button) findViewById(R.id.contrasena);
contrasena.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String usuario = ((EditText) findViewById(R.id.usuario)).getText().toString();
String password = ((EditText) findViewById(R.id.contrasena)).getText().toString();
if (usuario.equals("admin")&& password.equals("1234"))
{
startActivity (new Intent(RegistroActivity.this,MainActivity.class));
}
else
{
Toast.makeText(getApplicationContext(),"no existe", Toast.LENGTH_SHORT).show();
}
}
});
}
}
I do not know if I have to see what record a warning type is coming from, something that does not happen with the others, according to this image.