I get this nullPointerException on runtime:
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method \'void android.app.ActionB
If you check this answer in 2019 like me , the problem is about your android manifest:
Check the documentation here:
https://developer.android.com/training/appbar/setting-up.html
You also take in mind the previous answer from TetianaDev:
Instead of:
public class MainActivity extends Activity {
use:
public class MainActivity extends AppCompatActivity {
and instead of:
getActionBar().setTitle(mTitles);
use:
getSupportActionBar().setTitle(mTitles);
This works for me.