how to hide title bar in android code example

Example 1: kotlin remove name from an activity

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    try
    {
        this.getSupportActionBar().hide();
    }
    catch (NullPointerException e){}

    setContentView(R.layout.activity_main);
}

Example 2: android studio removing title bar

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar" />

Example 3: removing title bar from android app

res -> values -> styles.xml
<item name="windowNoTitle">true</item>