I recently moved to Android from python and am stuck here.
This is my class declaration to create a common function for an Alert Dialog which accepts necessary parameter
This works for me:
private void switchActivity(Class cls){ Intent intent = new Intent(HomeActivity.this, cls); startActivity(intent); }
Call the function like this: switchActivity(DestinationActivity.class)
switchActivity(DestinationActivity.class)