I have a programming assignment where I need show a graph. My professor provided us with the code for the graph but I am struggling to understand how to create a spot on the activity to show the graph.
Also trying to under how context and canvas are used.
so the two functions are
public GraphView(Context context, float[] values, String title, String[] horlabels, String[] verlabels, boolean type)
and
protected void onDraw(Canvas canvas)
Questions:
1. Which layouts can I use in the activity to show the x/y plane graph. I was thinking of using frame layout, will that work?
2. for passing in a parameter value for Context, I was thinking of using baseContext. But I don't really know if the difference between applicationContext and baseContext.
3. For passing in a parameter value for Canvas, will that be the id/value of the layout I choose. Like frameLayout?
last question.
4. If it is all part of the same package can I actually access the protected void onDraw function from the GraphView class?
Also trying to under how context and canvas are used.
so the two functions are
public GraphView(Context context, float[] values, String title, String[] horlabels, String[] verlabels, boolean type)
and
protected void onDraw(Canvas canvas)
Questions:
1. Which layouts can I use in the activity to show the x/y plane graph. I was thinking of using frame layout, will that work?
2. for passing in a parameter value for Context, I was thinking of using baseContext. But I don't really know if the difference between applicationContext and baseContext.
3. For passing in a parameter value for Canvas, will that be the id/value of the layout I choose. Like frameLayout?
last question.
4. If it is all part of the same package can I actually access the protected void onDraw function from the GraphView class?