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.