In an Android application, how do you start a new activity (GUI) when a button in another activity is clicked, and how do you pass data between these two activities?
When user clicks on the button, directly inside the XML like that:
Using the attribute android:onClick
we declare the method name that has to be present on the parent activity. So I have to create this method inside our activity like that:
public void buttonClickFunction(View v)
{
Intent intent = new Intent(getApplicationContext(), Your_Next_Activity.class);
startActivity(intent);
}