Code example for Intent

Methods: getBundleExtragetIntExtragetStringExtra

0
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		 
		Intent launchIntent = getIntent();
		final String fragclassname = launchIntent.getStringExtra(EXTRA_FRAGMENTNAME);
		final Bundle fragargs = launchIntent.getBundleExtra(EXTRA_FRAGMENTARGS);
		final int orient = launchIntent.getIntExtra(EXTRA_ORIENTATION, ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
		setRequestedOrientation(orient);
		 
		try { 
			Class<?> fragmentClass = getClassLoader().loadClass(fragclassname);
			mBaseFragment = (Fragment) fragmentClass.newInstance();
			mBaseFragment.setArguments(fragargs);
			 
			FragmentTransaction tr = getSupportFragmentManager().beginTransaction();
			tr.add(android.R.id.content, mBaseFragment);
			tr.commit();
			 
		} catch(Exception e) {
Stop searching for code, let great code find you!  Add Codota to your java IDE