[Solved] A_Class cannot be cast to B_Class?


Your class hierarchy is:

class Home_Page extends AppCompatActivity
class MainActivity extends AppCompatActivity

This is similar to the following:

class Dog extends Animal
class Cat extends Animal

You can cast a Dog to an Animal, but you can’t cast a Dog to a Cat.

In the same way, you can’t cast a Home_Page to a MainActivity.

1

solved A_Class cannot be cast to B_Class?