Skip to content

Instantly share code, notes, and snippets.

@dynoChris
Last active February 7, 2019 19:19
Show Gist options
  • Save dynoChris/7203702ebfed9e56dbc45b775e73b6d7 to your computer and use it in GitHub Desktop.
Save dynoChris/7203702ebfed9e56dbc45b775e73b6d7 to your computer and use it in GitHub Desktop.
Display the fragment as the main content of activity
public class SettingsActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Display the fragment as the main content.
getFragmentManager().beginTransaction()
.replace(android.R.id.content, new SomeFragment())
.commit();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment