I wrote a simple function to open a new activity on the "Next" button click
private Button Next;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_profile2);
Next = (Button) findViewById(R.id.continueNextButton);
Next.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
openBusinessProfile();
}
});
}
public void openBusinessProfile() {
Intent intent = new Intent(this, BusinessProfile.class);
startActivity(intent);
}
XML <Button
android:id="@+id/continueNextButton"
android:layout_width="120dp"
android:layout_height="40dp"
android:layout_below="@+id/codeText"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="138dp"
android:layout_marginTop="6dp"
android:layout_marginEnd="153dp"
android:layout_marginBottom="41dp"
android:background="@color/olive"
android:text="Next"
android:textAllCaps="false"
android:textColor="@android:color/white"
android:textSize="15dp" />
I've been using this method for more than 7 months and it always used to work but I am surprised it didn't work this time