Search code examples
androidexceptioncustom-viewandroid-custom-view

Using a custom view from xml. View class cast error


When running my code i get a java.lang.ClassCastException: android.view.View when I initialise the XML layout for my view.

Why?

UPDATE

Problem was since I was adding a button inside a view element. Corrected this placement and it worked again


Solution

  • Found my problem was elsewhere. Was adding a button inside a view element which seemed to be cause the exception.

    Thanks for your help