This is a migrated thread and some comments may be shown as answers.

Can I call FrescoDrawee image library in java for Android from my NativeScript app?

2 Answers 45 Views
General Discussion
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Stan
Top achievements
Rank 1
Stan asked on 04 Jan 2018, 03:12 AM

In my NativeScript app I need to resize my images before using it in the RadListView because of out of memory issues in Android. I have found a NativeScript-Fresco plugin but unfortunately it does not do resizing, however the Fresco library does have a resize routine, it's just not available in the NativeScript-Fresco plugin.

So, can I call FrescoDrawee (Facebook's image library in java for Android) from my NativeScript app?
If so , how do I do that?

Thanks so much!

2 Answers, 1 is accepted

Sort by
0
Nick Iliev
Telerik team
answered on 04 Jan 2018, 08:36 AM
Hi Stan,

In NativeScript 3.x.x there were some changes and optimizations for working with images on Android and properties
like decodeWidth and decodeHeight were introduced. In fact, the Fresco library can be dismissed if we are following the best practices
for using images in Android
.

However, if you still need to use the Fresco library you can extend the existing plugin (you can even contribute with a PR and provide the additional functionality so it can become a part of the nativescript-fresco plugin). The existing plugin is requiring the dependency to the Fresco library in the build.gradle here.
From that point, we can access the library classes, methods, and properties by using data conversion (Java to JavaScript) - examples can be found all over the code base of the plugin (e.g. here is the initialization of the Fresco). Examples of marshaling code from Java to javaScript can be found in this documentation article.

In case, extending the plugin (which is the recommended way) is considered overkill, you can include the library as project dependency in app/App_Resources/Android/app. file and once again access the library as mentioned above while using data conversion syntax.


Regards,
Nikolay Iliev
Progress Telerik
Did you know that you can open private support tickets which are reviewed and answered within 24h by the same team who built the components? This is available in our UI for NativeScript Pro + Support offering.
0
Stan
Top achievements
Rank 1
answered on 04 Jan 2018, 09:35 PM
Thank you for your insight. Have a happy new year.
Tags
General Discussion
Asked by
Stan
Top achievements
Rank 1
Answers by
Nick Iliev
Telerik team
Stan
Top achievements
Rank 1
Share this question
or