I'm sorry for asking such a basic question, but I haven't found anything that could help me with this issue. I'm trying to do something as simple as starting a new activity through a button click, but my application crashes whenever I click that button. Here is my code:
Button aboutButton = (Button)findViewById(R.id.aboutButton);
    aboutButton.setOnClickListener(new View.OnClickListener()
    {
        @Override
        public void onClick(View view)
        {
            Intent intent = new Intent(MainActivity.this, About.class);
            startActivity(intent);
        }
    });
This code is inside a function, which is in turn inside the onCreate function.
I've already tried putting this code straight into the onCreate function, but I got the same result.
Could you please tell me what I have done wrong?
PS.: My target activity is already declared at the manifest.
Error log :
 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ukdev.TestApp/com.ukdev.TestApp.About}: java.lang.NullPointerException
 
     
    