Thursday, January 28, 2010

GraphView problem

I designed one custom view which can draw the graphical view of real time incoming data.
The graphic view is extended from GraphView. when I included my current application, you need to write some code in XML file. such as

android:id="@+id/View01"
android:text="Test View:"
android:layout_below="@+id/TextView03"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>

However, several time I failed to do this, because constructor function is not define well
when I included the following constructor function on GraphView class


public GraphView(Context context) {
super(context);

}

public GraphView(Context context, AttributeSet attrs){
super(context, attrs);

}

public GraphView(Context context, AttributeSet attrs, int defStyle){
super(context, attrs, defStyle);

}

it works.

No comments: