Having the same issue. The button is initialized at the right time but for some reason, it crashes on click. The xml file says the onClick handler is missing the related activity.
xml
<Button
android:id="@+id/start_reg_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="216dp"
android:onClick="onClick"
android:text="@string/need_a_new_account" />
Java
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_start);
mRegBtn = (Button) findViewById(R.id.start_reg_btn);
mRegBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent reg_intent = new Intent(StartActivity.this, RegisterActivity.class);
startActivity(reg_intent);
}
});
}
Very new to android programming. Any help is appreciated