menu_on_top menu_on_top - 3 months ago 5
Android Question

how to connect two activities

i have made one screen with these two imgs and i would like to add a button down of the page witch will drive to a second page when i click you know how i will write it in?i know how to create a button but i dont know how to connect the two screens!thanks


This task is accomplished with the startActivity(); method using Intents.

Intent i = new Intent(FromActivity.this, ToActivity.class);

In this case the Intent uses your current Activity as the Context in the first parameter, and the destination Activity in the second parameter.

Make sure that you add your second Activity to the manifest also (it resides in the tag)!

<activity android:name=".ToActivity"