Good day. I had the following problem: my application consists of several activations. When the application is minimized, for example, from the activation "activity name 1" (the inscription on the action bar) in the list of minimized applications, the application is referred to as "activity name 1." This behavior is present on Android 4.1 - 4.4. I also need to minimize the application to always be called "App name." This behavior is explained by the fact that in the manifest file for each activation I have a parameter

<activity android:label="@string/activity_name_..." ... /> 

also written for the application itself

 <application android:label="@string/app_name" ... /> 

Unfortunately, simply removing the labels for activation from the manifest and setting upTitle () for the action bar is extremely undesirable in each of them, since all activations are inherited from the baseline and a custom action bar is created in the baseline, which uses the activity label. Is it possible to force the application to be called in a minimized form always "App name", while not changing the manifest?

activity name 1:

 public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_authentication); setupActionBar(getTitle()); 

base activity:

 protected void setupActionBar(CharSequence title) { ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); actionBar.setCustomView(R.layout.action_bar); ((TextView) findViewById(R.id.custom_action_bar_title)).setText(title); actionBar.show(); } } 

layaut actionbar:

 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout android:id="@+id/action_bar_custom" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/primary_color" android:padding="0dp" > <ImageView android:id="@+id/action_bar_logo" android:layout_width="?android:attr/actionBarSize" android:layout_height="?android:attr/actionBarSize" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:scaleType="centerCrop" android:src="@drawable/ic_logo" /> <TextView android:id="@+id/custom_action_bar_title" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignBottom="@id/action_bar_logo" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:layout_toRightOf="@id/action_bar_logo" android:gravity="center" android:textAppearance="@android:style/TextAppearance.Holo.Widget.ActionBar.Title" android:textColor="@color/text_icons" tools:text="HALLO!" /> <ProgressBar android:id="@+id/action_bar_progress" style="@android:style/Widget.ProgressBar.Horizontal" android:layout_width="match_parent" android:layout_height="2dp" android:layout_alignParentBottom="true" android:indeterminate="true" android:visibility="gone" /> </RelativeLayout> 

    1 answer 1

    It is possible to put another onPause() header in onPause() calling your own method, and in onStart() you can change it back.

    • Thanks for the answer, I also thought to do it, but I thought it was a crutch. Unfortunately, this method did not work, I conducted several experiments, including rewriting the method in this way, setupActionBar((getString(R.string.app_name)); result was that in the action bar the name of the application was always manifest of <activity android:label="@string/activity_name_..." ... /> . Thus, it turns out that without changing the manifest, nothing happens. - Antrc