I have a FragmentActivity where I have written code to create custom title bar as below in OnCreate() method :
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.main);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.mylayout);
The Problem is I need to access a button in “mylayout” in a Fragment that is hold by FragmentActivty.
My FragmentActivity name is “MainFragmentActivity” which extends FragmentActivity
My Fragment class that is hold by this FragmentActivity is “MyFragment”
Can anyone help me how to access the button present in title layout of FragmentActivity.
You shouldn’t need to do anything special; calling
findViewById(R.id.the_button);should work. TheActionBarCompatsample code in the SDK does this in ActionBarHelperBase.java.