title: Setting rendered image into ImageView instead of opeing a new Intent in Android with aChartEngine library
body: <p>I'm trying to set the rendered image into my ImageView instead of opening a new Intent but getting errors. </p>
  
  <pre><code>iv.setImageDrawable(ChartFactory.getPieChartView(getBaseContext(), distributionSeries, defaultRenderer));
  </code></pre>
  
  <p>here is my code for main class,</p>
  
  <pre><code>public class PieChart extends Activity {
  
      ImageView iv;
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          iv = (ImageView) findViewById (R.id.imageView1);
          CreatePieChart();
      }
  
      private void CreatePieChart() {
  
          // Pie Chart Section Names
          String[] code = new String[] { "IOS", "ANDROID" };
  
          // Pie Chart Section Value
          double[] distribution = { 40, 60 };
  
          // Color of each Pie Chart Sections
          int[] colors = { Color.GRAY, Color.GREEN };
  
          // Instantiating CategorySeries to plot Pie Chart
          CategorySeries distributionSeries = new CategorySeries(
                  "Mobile Platforms");
          for (int i = 0; i &lt; distribution.length; i++) {
              // Adding a slice with its values and name to the Pie Chart
              distributionSeries.add(code[i], distribution[i]);
          }
          // Instantiating a renderer for the Pie Chart
          DefaultRenderer defaultRenderer = new DefaultRenderer();
          for (int i = 0; i &lt; distribution.length; i++) {
              SimpleSeriesRenderer seriesRenderer = new SimpleSeriesRenderer();
              seriesRenderer.setColor(colors[i]);
              seriesRenderer.setDisplayChartValues(true);
              // Adding a renderer for a slice
              defaultRenderer.addSeriesRenderer(seriesRenderer);
          }
          defaultRenderer.setLegendTextSize(30);
          defaultRenderer.setBackgroundColor(Color.RED);
          defaultRenderer.setBackgroundColor(Color.RED);
          defaultRenderer.setChartTitle("Mobile Platforms");
          defaultRenderer.setChartTitleTextSize(20);
          defaultRenderer.setZoomButtonsVisible(true);
          defaultRenderer.setBackgroundColor(45454545);
  
          // Creating an intent to plot bar chart using dataset and
          // multipleRenderer
          //Intent intent = ChartFactory.getPieChartIntent(getBaseContext(),
                  //distributionSeries, defaultRenderer,"PieChart");
  
          iv.setImageDrawable(ChartFactory.getPieChartView(getBaseContext(), distributionSeries, defaultRenderer));
  
          // Start Activity
          //startActivity(intent);
  
      }
  </code></pre>
  
  <p>another problem is whenever i tried to set the background of the PieChart its showing a default color which is black,</p>
  
  <pre><code>defaultRenderer.setBackgroundColor(Color.RED);
  </code></pre>