We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Error Exporting chart to Android

Hi,

I have a XF chart in my project and the export to iOS works OK, but the export on Android fails with:

08-01 11:44:32.066 I/MonoDroid(22305): Java.IO.IOException: No such file or directory
08-01 11:44:32.066 I/MonoDroid(22305):   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <3fd174ff54b146228c505f23cf75ce71>:0
08-01 11:44:32.066 I/MonoDroid(22305):   at Java.Interop.JniEnvironment+InstanceMethods.CallBooleanMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00069] in <bd30a18775d94dc8b6263aecd1ca9077>:0
08-01 11:44:32.066 I/MonoDroid(22305):   at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualBooleanMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x0002a] in <bd30a18775d94dc8b6263aecd1ca9077>:0
08-01 11:44:32.066 I/MonoDroid(22305):   at Java.IO.File.CreateNewFile () [0x0000a] in <61dabd3f0b0446bc8b570d6071d995d7>:0
08-01 11:44:32.066 I/MonoDroid(22305):   at Syncfusion.SfChart.XForms.Droid.ChartDependencyService+<SaveAsImage>d__0.MoveNext () [0x00042] in <1e4446e48e6b4cf595ae2a48676fdb4d>:0
08-01 11:44:32.066 I/MonoDroid(22305): --- End of stack trace from previous location where exception was thrown ---
08-01 11:44:32.066 I/MonoDroid(22305):   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <3fd174ff54b146228c505f23cf75ce71>:0
08-01 11:44:32.066 I/MonoDroid(22305):   at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_0 (System.Object state) [0x00000] in <3fd174ff54b146228c505f23cf75ce71>:0
08-01 11:44:32.066 I/MonoDroid(22305):   at Android.App.SyncContext+<>c__DisplayClass2_0.<Post>b__0 () [0x00000] in <61dabd3f0b0446bc8b570d6071d995d7>:0
08-01 11:44:32.066 I/MonoDroid(22305):   at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in <61dabd3f0b0446bc8b570d6071d995d7>:0
08-01 11:44:32.066 I/MonoDroid(22305):   at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in <61dabd3f0b0446bc8b570d6071d995d7>:0
08-01 11:44:32.066 I/MonoDroid(22305):   at (wrapper dynamic-method) System.Object:9debb56f-082e-408f-8b9b-98f0b0ee179e (intptr,intptr)
08-01 11:44:32.066 I/MonoDroid(22305):   --- End of managed Java.IO.IOException stack trace ---
08-01 11:44:32.066 I/MonoDroid(22305): java.io.IOException: No such file or directory
08-01 11:44:32.066 I/MonoDroid(22305):  at java.io.UnixFileSystem.createFileExclusively0(Native Method)
08-01 11:44:32.066 I/MonoDroid(22305):  at java.io.UnixFileSystem.createFileExclusively(UnixFileSystem.java:280)
08-01 11:44:32.066 I/MonoDroid(22305):  at java.io.File.createNewFile(File.java:948)
08-01 11:44:32.066 I/MonoDroid(22305):  at md5270abb39e60627f0f200893b490a1ade.ButtonRenderer_ButtonClickListener.n_onClick(Native Method)
08-01 11:44:32.066 I/MonoDroid(22305):  at md5270abb39e60627f0f200893b490a1ade.ButtonRenderer_ButtonClickListener.onClick(ButtonRenderer_ButtonClickListener.java:30)
08-01 11:44:32.066 I/MonoDroid(22305):  at android.view.View.performClick(View.java:6199)
08-01 11:44:32.066 I/MonoDroid(22305):  at android.widget.TextView.performClick(TextView.java:11090)
08-01 11:44:32.066 I/MonoDroid(22305):  at android.view.View$PerformClick.run(View.java:23647)
08-01 11:44:32.066 I/MonoDroid(22305):  at android.os.Handler.handleCallback(Handler.java:751)
08-01 11:44:32.066 I/MonoDroid(22305):  at android.os.Handler.dispatchMessage(Handler.java:95)
08-01 11:44:32.066 I/MonoDroid(22305):  at android.os.Looper.loop(Looper.java:154)
08-01 11:44:32.066 I/MonoDroid(22305):  at android.app.ActivityThread.main(ActivityThread.java:6682)
08-01 11:44:32.066 I/MonoDroid(22305):  at java.lang.reflect.Method.invoke(Native Method)
08-01 11:44:32.066 I/MonoDroid(22305):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
08-01 11:44:32.066 I/MonoDroid(22305):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)


I have WRITE and READ external storage permissions in my Android Manifest file but it isn't making a difference.

Any suggestions?

Regards,

Raymond

5 Replies

SP Saravana Pandian Murugan Syncfusion Team August 2, 2017 02:29 PM UTC

Hi Raymond,

Thanks for contacting Syncfusion support.

We were not able to reproduce the reported issue at our end and we have prepared a sample for this. Please update us the modified sample to reproduce the issue which will be helpful for providing further assistance on this.

Sample: http://www.syncfusion.com/downloads/support/forum/131874/ze/SaveAsImage-960786600

Note:

The exported image will be saved in different location across the platforms.

Android – The image will be saved inside the Pictures directory. You can find it using the file explorer application.

iOS – The image will be saved inside the “Photos/Album” directory.

UWP – A Save as dialog box will appear to choose the storage location.

Please let us know if you are still facing this issue.

Regards,
Saravana Pandian M.



RD Raymond Dillon August 2, 2017 02:53 PM UTC

Hi,

The sample works perfectly, but I am unsure how as there are no permissions set in the manifest - particularly for accessing files?

Regards,

Raymond



SP Saravana Pandian Murugan Syncfusion Team August 3, 2017 04:05 PM UTC

Hi Raymond, 
 
Regarding  but I am unsure how as there are no permissions set in the manifest - particularly for accessing files? 
 
You no need to enable Read/Write permission to save Chart as an image. In source level, we save this chart as an image by creating a new file (name of the image file) under Pictures folder of ExternalStorage. 
 
Are you able to run our sample in the device in which you are facing this issue? If yes, can you able to see the chart image under Pictures folder? 
 
If not, please update us the modified sample or update us the with more details (Device details) in which you are facing this issue which will be helpful to assist you further. 
 
Regards, 
Saravana Pandian M. 



DF Dave Friedel April 20, 2021 01:15 PM UTC

I know how to reproduce it...

Simply try to export using this filename and it will give the error.

chartData.SaveAsImage("img" + DateTime.Now.ToString() + ".jpg")

I was trying to make an image increment based on time and had it happen


GM Gayathri Manickam Syncfusion Team April 21, 2021 09:58 AM UTC

Hi Dave, 
 
Thanks for contacting Syncfusion support. 
 
We would like to let you know that the default format for DateTime value consider like "4/21/2021 3:38:31". Hence the file manager mistook it as directory and search for the folder name. Please try with the other format in DateTime for storing the image. 
 
Please refer the following code snippet for another format in DateTime. 
 
chart.SaveAsImage("img" + DateTime.Now.ToString("dd_MM_yyyy") + ".jpg");   // img21_04_2021.jpg 
 
or 
 
var date = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString(); 
 
chart.SaveAsImage("img" + date + ".jpg");  // img2021421.jpg 
 
Please let us know if you require further assistance. 
 
Thanks, 
Gayathri M. 


Loader.
Live Chat Icon For mobile
Up arrow icon