I'm trying to include a menu in my Graph view. I have the graph working perfectly, and on the main activity, I have the menu working fine. I just can't seem to get the menu to show up in my graphing activity.
Here is the code inside LineGraph.java:
public class LineGraph extends Activity {
//me trying to initialize the menu
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_graph, menu);
return true;
}
public Intent getIntent(Context context){
//data
int[] x = {1,2,3,4,5,6,7,8,9,10}; //x values
int[] y = {30,34,45,80,57,77,89,100,111,123,145};//yvalues
TimeSeries series = new TimeSeries("Caffeine Level");
for(int i = 0; i<x.length;i++){
series.add(x[i], y[i]);
}
XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();
dataset.addSeries(series);
XYMultipleSeriesRenderer mRenderer = new XYMultipleSeriesRenderer();
XYSeriesRenderer renderer = new XYSeriesRenderer();
mRenderer.setXTitle("Title");
mRenderer.setYTitle("ytitle");
mRenderer.addSeriesRenderer(renderer);
mRenderer.setBackgroundColor(Color.BLACK);
Intent intent = ChartFactory.getLineChartIntent(context, dataset, mRenderer, "Line Graph");
return intent;
}
}
I'm sure this is a simple change, but I have tried searching, and I cannot seem to find the answer. The obvious things (at least to me) have been checked. For example, I am using the correct R, the activity_graph exists inside the /res/menu directory. What am I doing wrong? Thanks!