简体   繁体   中英

click home button in fragment page to disappear action bar activity title

  • I am facing weird issue.I am using PageActivity inside three fragments swipes one after another and so on.

  • My problem is,when I am in FragmentA page,on click the home button ,again come back to the application, my action bar title name is Chapter ,which I was added the action bar title name in PageActivity and after 2 seconds the fragment title was loading with the help of query.

  • My only problem is,on home button click in fragment page instead of activity title name,Fragment page title name have to be shown directly after enter the application.

Below I am posted the code related to this:

PageActivity.java:

public class PageActivity extends FragmentActivity {

 static TextView mTitleTextView;
.......
.......
@Override
    protected void onResume() {
    super.onResume();
    ActionBar(Constants.Titlebarcolor);
........
........
}

public void ActionBar(String color) {
        ActionBar mActionBar = getActionBar();
        mActionBar.setDisplayShowHomeEnabled(false);

mTitleTextView = (TextView) mCustomView.findViewById(R.id.textviewHeading);
  mTitleTextView.setText("Chapter");

}

FragmentPageA.java:

   @Override
    public void onResume() {
        super.onResume();
....
....
  }

 @Override
    public void onPause() {
        super.onPause();
....
....
  }

 @Override
    public void setMenuVisibility(final boolean visible) {

 //get action bar title for every fragment page   
   PageActivity.mTitleTextView.setText(DatabaseQueryHelper.getInstance().getPagename(getArguments().getInt(Constants.PAGEID)));
......
......
}

Anyone can give me any suggestion regarding to this.Thank you.

I just moved this ActionBar(Constants.Titlebarcolor); line inside onResume() method to onCrate() method.

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ActionBar(Constants.Titlebarcolor);
}

So that When I entering into the activity,the action bar activity title will not resume.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM