in my app i am trying to show a pie chart. When i was searching through google i found an sample code in the following link
http://blog.gafmediastudio.com/2010/04/01/draw-a-pie-chart-with-android/comment-page-1/#comment-3899 the code is very useful but i have a problem in the code. They have used random colors and random number of counts in the pie chart. So i changed it to the number of counts i need but i am not able to change the color. How to change the color please help me. Following is the main activity code public class MainActivity extends Activity { List<PieDetailsItem> PieData = new ArrayList<PieDetailsItem>(0); /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); PieDetailsItem Item; Random mNumGen = new Random(); int MaxPieItems = 3; // mNumGen.nextInt(20); int MaxCount = 0; int ItemCount = 0; for (int i = 0; i < MaxPieItems ; i++) { ItemCount = 3; // mNumGen.nextInt(256); Item = new PieDetailsItem(); Item.Count = ItemCount; Item.Label = "Valeur " + 3; // mNumGen.nextInt(1000); Item.Color = 0xff000000 +256*256*mNumGen.nextInt(256) + 256*mNumGen.nextInt(256) + mNumGen.nextInt(256); // + 1 + 256*2 + 3; PieData.add(Item); MaxCount += ItemCount; } int OverlayId = R.drawable.cam_overlay_big; int Size = 120; int BgColor = 0xffa1a1a1; Bitmap mBackgroundImage = Bitmap.createBitmap(Size, Size, Bitmap.Config.RGB_565); View_PieChart PieChartView = new View_PieChart( this ); PieChartView.setLayoutParams(new LayoutParams(Size, Size)); PieChartView.setGeometry(Size, Size, 8, 8, 8, 8, OverlayId); PieChartView.setSkinParams(BgColor); PieChartView.setData(PieData, MaxCount); PieChartView.invalidate(); PieChartView.draw(new Canvas(mBackgroundImage)); PieChartView = null; ImageView mImageView = new ImageView(this); mImageView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); mImageView.setBackgroundColor(BgColor); mImageView.setImageBitmap( mBackgroundImage ); LinearLayout TargetPieView = (LinearLayout) findViewById(R.id.pie_container); TargetPieView.addView(mImageView); } } the line which is marked in red text is the place to mention the color for the pie chart. please help me........ -- Siva Shankar K -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

