Android - AttributeSet

android

Solution

http://developer.android.com/training/custom-views/create-view.html - this is an explanation.

Shortly, attributeSet is needed for GUI editor. AttributeSet is a set of parameters like `layout_width`, `layour_height` and so on. It you need you new custom attributes, the you need to extend to expand AttributSet class

Problem

I have a code something like this: ``` public class CannonView extends SurfaceViewimplements SurfaceHolder.Callback{ Activity activity; ``` And its constructor: ``` public CannonView(Context context, AttributeSet attrs){ Super(context,attrs) activity = (Activity) context; ``` but apparently the AttributeSet is doing nothing, I dont know why is there, so my questions are: 1.-what is AttributeSet? 2.-why do we need to provide AttributeSet attrs as a second argument? by the way the rest of code is for painting using canvas. Thanks.

Original source