I have a Relative layout
(useMe) that loads one of two fragments on creation depending on the orientation of the screen. I keep getting the error
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.RelativeLayout.setOnClickListener(android.view.View$OnClickListener)' on a null object reference
the problem is this little bit of code right here
RelativeLayout useMe = (RelativeLayout) findViewById(R.id.startpage_activity);
useMe.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(StartPage.this, Question1.class);
startActivity(intent);
}
});
How is the useMe
a null object?
and define Activity in Manifest file