private boolean setApplicationDefaultTheme(int themeResId) {
		try {
			if (themeResId != 0) {
				// If passed theme res id does not exist, an exception would be thrown and caught
				appContext.getResources().getResourceName(themeResId);

				// Check if the theme to be inherited from is an AppCompat theme.
				Resources.Theme appDefaultTheme = appContext.getResources().newTheme();
				appDefaultTheme.applyStyle(themeResId, true);

				TypedArray a = appDefaultTheme.obtainStyledAttributes(android.support.v7.appcompat.R.styleable.AppCompatTheme);
				try {
					if (a.hasValue(android.support.v7.appcompat.R.styleable.AppCompatTheme_colorPrimaryDark)) {
						// Only set to use if it's an AppCompat theme. See updateApptentiveInteractionTheme() for theme inheritance chain
						appDefaultAppCompatThemeId = themeResId;
						return true;
					}
				} finally {
					a.recycle();
				}
			}
		} catch (Resources.NotFoundException e) {
			ApptentiveLog.e("Theme Res id not found");
			logException(e);
		}
		return false;
	}
private boolean setApplicationDefaultTheme ( int themeResId ) { try { if ( themeResId != 0 ) { appContext . getResources ( ) . getResourceName ( themeResId ) ; Resources . Theme appDefaultTheme = appContext . getResources ( ) . newTheme ( ) ; appDefaultTheme . applyStyle ( themeResId , true ) ; TypedArray a = appDefaultTheme . obtainStyledAttributes ( android . support . v7 . appcompat . R . styleable . AppCompatTheme ) ; try { if ( a . hasValue ( android . support . v7 . appcompat . R . styleable . AppCompatTheme_colorPrimaryDark ) ) { appDefaultAppCompatThemeId = themeResId ; return true ; } } finally { a . recycle ( ) ; } } } catch ( Resources . NotFoundException e ) { ApptentiveLog . e ( "Theme Res id not found" ) ; logException ( e ) ; } return false ; }
/*
Set default theme whom Apptentive UI will inherit theme attributes from. Apptentive will only
inherit from an AppCompat theme
@param themeResId : resource id of the theme style definition, such as R.style.MyAppTheme
@return true if the theme is set for inheritance successfully.