It is working but your ifs are out of place. It should be something like this:
if (!this.opened && tabIndex > 0) {
				setTabOrIndex = tabIndex;
				return;
			} else if (tabIndex < 0 || tabIndex >= tabs.size()) {
				Log.e(TAG, "Invalid tab index.");
				return;
			}