Android SupportActionBar aktualisiert den Titel nicht

Ich habe ein Problem mit der Aktualisierung des ActionBar-Titels. Die Anwendung ist ziemlich einfach, derzeit gibt es nur eine Aktivität:

    <android.support.design.widget.AppBarLayout
        android:id="@+id/app_bar"
        android:layout_width="match_parent"
        android:layout_height="@dimen/app_bar_height"
        android:fitsSystemWindows="true"
        android:theme="@style/AppTheme.AppBarOverlay">

        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/toolbar_layout"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:fitsSystemWindows="true"
            app:contentScrim="?attr/colorPrimary"
            app:layout_scrollFlags="scroll|exitUntilCollapsed">

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                app:layout_collapseMode="pin"
                app:popupTheme="@style/AppTheme.PopupOverlay"/>

        </android.support.design.widget.CollapsingToolbarLayout>
    </android.support.design.widget.AppBarLayout>

    <include layout="@layout/content_count_scrolling"/>

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fabReset"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="@dimen/fab_margin"
        android:src="@android:drawable/ic_dialog_alert"
        app:layout_anchor="@id/app_bar"
        app:layout_anchorGravity="bottom|end"/>

</android.support.design.widget.CoordinatorLayout>

Das Layoutcontent_count_scrolling enthält nurNestedScrollView mitRecyclerView Innerhalb

Mein Fall ist, wenn ich eine Ziffer in das @ eingeEditText in einer beliebigen Zeile von RecyclerView legt einen Wert im Datenmodell fest und berechnet den Gesamtwert (Summe aus allen Zeilen) neu. Dieser Gesamtwert sollte als @ festgelegt werdeActionBar.title. Dazu benutze ich auch RxBus. Hauptaktivität wie folgt:

public class MainActivity extends AppCompatActivity {
    // ....
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main_scrolling);
        toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        toolbar.setTitle("");

        mRxBus = getRxBusSingleton();        
        // ....
    }
}

public void refreshActionBarTitle() {
    String total = Data.getTotal();
    Timber.d("Refresh bar title with value="+total);

    toolbar.setTitle("");
    setSupportActionBar(toolbar);
    toolbar.setTitle("Title "+total);

    // testes also with:
    // getSupportActionBar().setTitle("Title "+total);

    Timber.d("Title after refresh: " + getSupportActionBar().getTitle());
}

`

MethoderefreshActionBarTitle() wird von RxBus ausgelöst. Sobald die Methode ausgelöst wird, wird der Titel desActionBar ist auch gesetzt (geprüft mit Logs und Debugger). Das Problem ist, dass ActionBar nicht ungültig gemacht und neu gezeichnet wird. Dies erfolgt erst nach dem Drehen des Bildschirms, was offensichtlich ist.

Also, bitte helfen Sie mir bei der korrekten Deaktivierung der Symbolleiste. Ich muss auch beachten, dass dieses Ereignis nach jeder Änderung in @ ausgelöst wirEditText, nicht nur nach dem Ändern des Fokus, also kann ich nicht zB ungültig machen. ganzer Bildschirm

Ich habe auch Ratschläge von @ geprüToolbar (SupportActionBar) -Titel ändert sich bei Änderung der Ausrichtung in App-Name, aber sie haben mir nicht geholfen.

Antworten auf die Frage(2)

Ihre Antwort auf die Frage