Here is the code that I am using. I have removed the code that generates other information displayed in the row and have provided only the code related to the creation and addition of the pie chart. If I remove the line "layout.addView(mChartView);" then the table is produced and it show all the other information, but of course , it does not show the pie chart.
TableLayout table = (TableLayout) findViewById(R.id.table);
TableRow row = (TableRow) findViewById(R.id.tableRow);
LayoutInflater inflater = getLayoutInflater();
GlobalData global = ((GlobalData)getApplicationContext());
for( int i = 0; i < global.getData(0).size(); i++){
DataModel current = global.getData(0).get(i);
row = (TableRow)inflater.inflate(R.layout.tablerow, table, false);
row.setTag(i);
row.setClickable(true);
//pie chart
RelativeLayout layout = (RelativeLayout) findViewById(R.id.chart);
int[] values = {50, 100};
CategorySeries series = new CategorySeries("Market share");
int k = 0;
for (int value : values) {
series.add("Section " + ++k, value);
}
int[] colors = new int[] { Color.BLUE, Color.YELLOW };
DefaultRenderer renderer = new DefaultRenderer();
for (int color : colors) {
SimpleSeriesRenderer r = new SimpleSeriesRenderer();
r.setColor(color);
renderer.addSeriesRenderer(r);
}
mChartView = ChartFactory.getPieChartView(null, series, renderer);
layout.addView(mChartView);
// Add the TableRow to the TableLayout
table.addView(row);
This code snippet is located in the onCreate event of the view.
Thank you for trying to help.