Reputation: 1704
How to retrieve title of Action bar and assign it to text view?
I tried below code but it's not working...
Code:
t1 = rootView.findViewById(R.id.textview1);
t1.setText(getActivity().getActionBar().getTitle().toString());
Upvotes: 1
Views: 214
Reputation: 8853
You can get the title from Support ActionBar, Use below code.
YourActivity.this.getSupportActionBar().getTitle();
Upvotes: 1
Reputation: 222
for java:
getActivity().getTitle()
for kotlin:
activity.title
Upvotes: 1