Alex Rivera | Logout

.java not using the 2- or 3-argument View constructors; XML attributes will not work

Asked 2012-12-10T08:31:43.527
22

i'm newbie i have problem creating game

execute process

activity_main.xml -> MainActivity.java -> GameLoop.java -> action.xml (error) -> CustomView.java

Custom view CustomView is not using the 2- or 3-argument View constructors; XML attributes will not work

I don't understand......

Edit
Report

1 Answer

11

You need to implement these constructors also:

//Constructor that is called when inflating a view from XML.
View(Context context, AttributeSet attrs)

//Perform inflation from XML and apply a class-specific base style.
View(Context context, AttributeSet attrs, int defStyle)
answered 2012-12-10T08:40:01.170

Your Answer