Sempre quando abro o app ele crasha após que implementei esta parte do código:
FloatingActionButton FabNewStudent = findViewById(R.id.activity_main_fab_newStudent);
FabNewStudent.setOnClickListener( new View.OnClickListener()
@Override
public void onClick(View view) {
startActivity(new Intent(ListStudentsActivity.this,
FormularyStudentActivity.class));
}
});
O logcat mandou a seguinte exception:
java.lang.RuntimeException: Unable to start activity ComponentInfo{br.com.aluraAndroid1.agenda/br.com.aluraAndroid1.agenda.ui.activity.ListStudentsActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.design.widget.FloatingActionButton.setOnClickListener(android.view.View$OnClickListener)' on a null object reference