Call another Layout

1

When placing email and password the app should call another layout. I just can not do this ...

Intent intent = new Intent(this, R.layout.activity_estado);
startActivity(intent);

Report the following error: Can not resolve constructor 'Intent' (model.Principal, int);

I confess that I'm a beginner on Android.

Thank you in advance

    
asked by anonymous 09.01.2017 / 16:34

2 answers

3

You are putting the layout in the place where you need to insert a class. Basically in this case, you will need to create another Activity , for example ActivityEstado , with your layout activity_estado.xml . Then insert it into your manifest.xml . Once done, you can change screens using the startActivity() method. See:

Main

Intent intent = new Intent(this, ActivityEstado.class);
startActivity(intent);

manifest.xml:

<activity android:name=".ActivityEstado"/>

See here in the Android documentation all about Intent 'here in article < Android Intents - Tutorial

    

09.01.2017 / 16:57
3

Instead of

Intent intent = new Intent(this, R.layout.activity_estado);
startActivity(intent);

Use

Intent intent = new Intent(this, ActivityEstado.class);
startActivity(intent);

The second Intent parameter is the Class, not the layout.

    
09.01.2017 / 16:41