Skip to content

Instantly share code, notes, and snippets.

@jhonkaman
Last active July 4, 2018 17:36
Show Gist options
  • Save jhonkaman/3191eebc70b72ff1a9b2e791c58868f0 to your computer and use it in GitHub Desktop.
Save jhonkaman/3191eebc70b72ff1a9b2e791c58868f0 to your computer and use it in GitHub Desktop.
Android: Using an intent to launch a second activity
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
/* Relevant Code */
public void onClick(View view) {
// Instantiate an Intent object
Intent intent = new Intent(this, SecondActivity.class);
// Start the new activity
startActivity(intent);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment