Code example for FrameLayout.LayoutParams

0
	@Override 
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		FrameLayout frame = new FrameLayout(this);
		frame.setId(CONTENT_VIEW_ID);
		setContentView(frame, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
 
		if (savedInstanceState == null) {
			setInitialFragment(); 
		} 
	} 
 
 
	private void setInitialFragment() { 
		FragmentManager fragmentManager = getSupportFragmentManager();
		FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
		fragmentTransaction.add(CONTENT_VIEW_ID, MainFragment.newInstance()).commit();
	} 
 
} 
Stop searching for code, let great code find you!  Add Codota to your java IDE