private void addTabToGroup(TiUITabGroup tg, TabProxy tab) { TiTabActivity tta = weakActivity.get(); if (tta == null) { if (DBG) { Log.w(LCAT, "Could not add tab because tab activity no longer exists"); } } Drawable icon = TiDrawableReference.fromObject(getTiContext(), tab.getProperty(TiC.PROPERTY_ICON)) .getDrawable(); String tag = TiConvert.toString(tab.getProperty(TiC.PROPERTY_TAG)); String title = TiConvert.toString(tab.getProperty(TiC.PROPERTY_TITLE)); if (title == null) { title = ""; } tab.setTabGroup(this); final WindowProxy vp = (WindowProxy) tab.getProperty(TiC.PROPERTY_WINDOW); vp.setTabGroupProxy(this); vp.setTabProxy(tab); if (tag != null && vp != null) { TabSpec tspec = tg.newTab(tag); if (icon == null) { tspec.setIndicator(title); } else { tspec.setIndicator(title, icon); } Intent intent = new Intent(tta, TiActivity.class); vp.fillIntentForTab(intent); tspec.setContent(intent); tg.addTab(tspec); } }