Skip to content

Commit 1cb9e9b

Browse files
TonyTandAndroidTonyTangAndroid
authored andcommitted
Confirm post Runnable is no longer necessary to update toolbar title on app starts.
1 parent 787841f commit 1cb9e9b

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

app/src/main/java/io/anycopy/googleplusdemo/MainFragment.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import androidx.annotation.NonNull;
1313
import androidx.annotation.Nullable;
1414
import androidx.appcompat.app.ActionBarDrawerToggle;
15-
import androidx.appcompat.app.AppCompatActivity;
1615
import androidx.appcompat.widget.Toolbar;
1716
import androidx.core.view.GravityCompat;
1817
import androidx.drawerlayout.widget.DrawerLayout;
@@ -79,9 +78,6 @@ public void onViewCreated(@NonNull View rootView, @Nullable Bundle savedInstance
7978
navigationView = rootView.findViewById(R.id.nav_view);
8079
drawer = rootView.findViewById(R.id.drawer_layout);
8180
rootView.findViewById(R.id.floating_action_button).setOnClickListener(view -> onFabClicked());
82-
83-
((AppCompatActivity) requireActivity()).setSupportActionBar(toolbar);
84-
8581
GooglePlusFragmentPageAdapter adapter = new GooglePlusFragmentPageAdapter(getChildFragmentManager());
8682
viewPager.setAdapter(adapter);
8783
viewPager.setOffscreenPageLimit(adapter.getCount() - 1);
@@ -93,7 +89,7 @@ public void onViewCreated(@NonNull View rootView, @Nullable Bundle savedInstance
9389

9490

9591
private void initTitle() {
96-
toolbar.post(() -> toolbar.setTitle(navigation.getMenu().getItem(0).getTitle()));
92+
toolbar.setTitle(navigation.getMenu().getItem(0).getTitle());
9793
}
9894

9995
private void bindNavigationDrawer() {

0 commit comments

Comments
 (0)