예제 #1
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            chartLayout.DrawingCacheEnabled = true;
            chartLayout.BuildDrawingCache(true);
            chartbitmap = chartLayout.GetDrawingCache(true).Copy(Config.Rgb565, false);
            chartLayout.DestroyDrawingCache();

            var storage  = Android.OS.Environment.ExternalStorageDirectory.AbsolutePath;
            var filePath = System.IO.Path.Combine(storage, "Chart.png");
            var stream   = new FileStream(filePath, FileMode.Create);

            chartbitmap.Compress(CompressFormat.Png, 100, stream);
            stream.Close();

            var alert = new AlertDialog.Builder(this);

            alert.SetTitle("A Graph has been saved");
            alert.SetMessage("File is located at: " + filePath.ToString());
            alert.Show();
        }