• Coding
  • Android Studio one click button not working

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
Did you try to put Logs inside the button click before and after openBusinessProfile functions? Are you sure you defined the activity tag for BusinessProfile in the manifest?
Always use break points and see if your function is getting called.
After couple of days with 0 progress som1 recommended me to "Build -> clean project" in Android Studio which surprisingly fixed everything, that was frustrating to deal with considering no online solution worked