My app has two activities: MainActivity and OnlineActivity. The code snippet of onCreate method of MainActivity.java is: 
 protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
       Button btnOnline = (Button)findViewById(R.id.Online);
        if (btnOnline != null){
            btnOnline.setOnClickListener(new Button.OnClickListener() {
                @Override
                public void onClick(View v) {
                     online();
                }
            });
        }
    }
The online method inside MainActivity.java is defined as follows:
 private void online() {
        Intent intent = new Intent(packageContext:MainActivity.this, OnlineActivity.class);
        startActivity(intent);
    }
Similarly, code snippet of onCreate method of OnlineActivity.java is:
protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.content_main);}
The activity_main.xml has a button (button id is Online) and the content_main.xml has a simple text view.
While running the app, the button is displayed first, while pressing on the button the app crashes without any error (next view is not displayed).
The Logcat (Verbose) is as follows:
After crashing, the displayed message is My_App keeps stopping. And I get App info and Close app options.
What could have gone wrong in my code?
Thank you.

 
     
    