<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_weight="1"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/AppTheme.PopupOverlay"
app:title="@string/app_name">
</android.support.v7.widget.Toolbar>
The above is the code which is in the actitvity_main2.xml which is the child activity of activity_main.xml.
I want to change the title of this child activity when I pass from Main activity to Main2Acitivty. This is the picture which has the title of the main application(i.e. Stocks).

I want to change the title to something else when Main2Activity(this activity contains Tabbed views as you can see in the image) is loaded. I tried to use getActionBar().setTitle(<name to put on title>); and also used setTitle(<name to put in the title>) but nothing worked.
Please help as I am new to android.
Make Style in sytle.xml file
Call below code from your first activity
On SecondActivity
and make sure to check in manifest file.
if you use toolbar then you have to put this theme in that activity in manifest file
I hope this will resolve your issue.