Code example for Intent

Methods: addFlagssetClassName

0
	int maHomeScreenShortcutAdd(String name)
	{ 
		homeScreenPanicIfPermissionsAreNotSet(); 
 
		// Create intent for the shortcut launcher. 
		Intent shortcutIntent = new Intent(Intent.ACTION_MAIN);
		shortcutIntent.setClassName(getActivity(), getActivity().getClass().getName());
		shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
		shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
		shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
		shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
 
		// Get icon resource. 
		int icon = getActivity().getResources().getIdentifier(
			"icon", 
			"drawable", 
			getActivity().getPackageName());
 
		// Create intent for adding a shortcut icon. 
		Intent intent = new Intent();
Stop searching for code, let great code find you!  Add Codota to your java IDE