I have a Class
called LineGraphView
which is a subclass of View
. I want to be able to pass some data to this view so that it can then draw accordingly in its onDraw()
method.
Analysis Fragment (Where the view is referenced and method is called from)
LineGraphView altitudeGraph;
LineGraphView speedGraph;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup group, Bundle saved)
{
super.onCreateView(inflater, group, saved);
View view = inflater.inflate(R.layout.analysisfrag, group, false);
this.altitudeGraph = (LineGraphView) view.findViewById(R.id.linegraph_Altitude);
this.speedGraph = (LineGraphView) view.findViewById(R.id.linegraph_Speed);
return view;
}
My question is, if I then want to be able to access that views width and height attributes using getWidth()
and getHeight()
, when am I able to do so because so far all thats being returned is 0
.
Do I need to create a listener which lets the LineGraphView's
parent know its ready to be accessed?
Thanks in advance.