I have customized a component ButtomHurdle, that has buttons, and I want to start other activities through buttons, but the ButtomHurdle class does not inherit the Activity class, so I cannot use the startActivity method to start other classes. When I listen to the button, I try to use view.getContext () to call startActivity,. Although the compilation is successful, clicking the button still does not respond.
public void onClick (View view) {
switch (view.getId()){
case R.id.bottom :
intent = new Intent(view.getContext(), CateGory.class);
view.getContext().startActivity(intent);
}
}
how do I start other activities through Intent in custom components?