question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Provision for passing drawable object instead of drawable resource id

See original GitHub issue

Hi @zawadz88,

I am basically writing ReactNative native bridge of this library in order to using it with ReactNative projects.

I am stuck at place where from JS I am receiving icon information and using that I am able to create Drawable object, now the challenge is how to pass this drawable to item.setIcon method.

Since this API only except drawable resource, I am not able to pass the created drawable. Is it possible to have one more method which accepts raw drawable, may be we can achieve this by method overloading.

Please find reference below to the ReactNative library which I am working on: react-native-popover-menu Bridging Class

In case if you are lined up with other assignments, can you please guide me on how to enable this API. I will try my level best in order to enable this functionality.

P.S: Please consider me as beginner with Kotlin

Thanks Pranav

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
zawadz88commented, Feb 17, 2018

Hi @prscX, This is available now in 1.3.0.

2reactions
zawadz88commented, Feb 1, 2018

Hi Pranav, Thanks for raising this issue. This seems like a very nice enhancement to the library. I’m going on holidays now but I’ll surely add it once I’m back!

For the time being I believe you could actually make this work by using a custom item introduced in 1.2.0. In customItem you could specify a layoutResId with an ID to the one used for the default item and in viewBoundCallback find the icon ImageView and set the Drawable there.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Drawable resources - Android Developers
A drawable resource is a general concept for a graphic that can be drawn to the screen and which you can retrieve with...
Read more >
Set drawable resource ID in android:src for ImageView using ...
Here is my object: public class Recipe implements Parcelable { public final int imageResource; // resource ID (e.g. R. drawable. some_image) ...
Read more >
Drawable Resources | Android Developers - MIT
A drawable resource is a general concept for a graphic that can be drawn to the screen and which you can retrieve with...
Read more >
How to store drawable resources ID in the form of R.drawable ...
This example demonstrates about How to store drawable resources ID in the form of R.drawable.* inside an array using an XML values file....
Read more >
Understanding App Resources | CodePath Android Cliffnotes
Drawables, drawable, Bitmap files or XML files that act as graphics ... resources using just the key name rather than by "hardcoding" the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found