1

I am trying to change the title of my Activity but I am getting this NullPointerException. Can anyone help me with this?

public class SignUp extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sign_up);
    ActionBar actionBar=getSupportActionBar();
    //actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle("SignUp");
}

I have tried setting setDisplayShowTitleEnabled() to true but still doesn't work. I've tried other solutions from other similar questions but none seems to be helping.

Sachin Parashar
  • 1,067
  • 2
  • 18
  • 28
  • check the AndroidManifest.xml of your app and make sure you are using a theme with has the ActionBar – Blackbelt Dec 14 '15 at 11:37
  • post your style.xml file – User_1191 Dec 14 '15 at 11:39
  • Please post your styles and layout code here – Varun Kumar Dec 14 '15 at 11:43
  • – Sachin Parashar Dec 14 '15 at 11:52

1 Answers1

1

Your class extends from AppCompatActivity, so you have the option to use setTitle()

Timmeeh93
  • 223
  • 1
  • 4
  • 14