'setOnClickListener start another activity

I'm trying to start another activity by pressing on the cardview which has a friend finder id. But when I write home.java it gives me problems in the setOnClickListener. At homeActivity it tells me Cannot resolve method 'homeActivity' in 'HomeActivity'. because?

public class HomeActivity extends AppCompatActivity {
private CardView btn_home;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    btn_home = findViewById(androidx.appcompat.R.id.home);

    btn_home.setOnClickListener(v -> homeActivity(new Intent(HomeActivity.this, TrovamicoActivity.class)));

}


Solution 1:[1]

btn_home.setOnClickListener(new View.OnClickListener() {

      @Override
      public void onClick(View view) {
        Intent intent = new Intent(HomeActivity.this, TrovamicoActivity.class);
        startActivity(intent);
      }

    });

If there is no code in the manifest, write it

<activity android:name=".TrovamicoActivity" />

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1