Android Add Up Button into Action Bar

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="iterator.ir.a039">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".ChildOneActivity" android:parentActivityName=".MainActivity"/>
        <activity android:name=".ChildTwoActivity" android:parentActivityName=".MainActivity"/>
    </application>

</manifest>

ChildOneActivity.java

public class ChildOneActivity extends AppCompatActivity {

    Button buttonOpenChildTwo;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_child_one);

        getSupportActionBar().setDisplayHomeAsUpEnabled(true);

        buttonOpenChildTwo= (Button) findViewById(R.id.buttonOpenChildTwo);
        buttonOpenChildTwo.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent=new Intent(getBaseContext(),ChildTwoActivity.class);
                startActivity(intent);
            }
        });
    }
}

ChildTwoActivity.java

public class ChildTwoActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_child_two);

        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    }
}

References
https://github.com/mhdr/AndroidSamples/tree/master/039