android - How to get a view from an activity, which is located inside a tab, while the view is located outside the tab -
i have layout inludes actionbar , tabs:
<tabhost xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/tabhost" android:layout_width="fill_parent" android:layout_height="fill_parent"> <linearlayout style="@style/backgroundlayer"> <!-- action bar buttons --> <include layout="@layout/incl_actionbar"/> <tabwidget android:id="@android:id/tabs" android:layout_width="fill_parent" android:layout_height="wrap_content"/> <framelayout android:id="@android:id/tabcontent" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="5dp" /> </linearlayout> </tabhost>
and on actionbar have several buttons need able access activities within tabs. findviewbyid returns null view located on actionbar - find quite logical, because activity inside tab contentroot framelayout (and actionbar ourside of it), nevertheless need access actionbar, because icons available actions located there.
i have thought of passing actionbar intents activities inside tabs, view not serializable nor parcelable, can't passed extra.
let tabactivity provide access actionbar. child activities should request actionbar using following code, e.g.:
view actionbar = ((customtabactivity) getparent()).getactionbar();
Comments
Post a Comment