Dasser Basyouni
Dasser Basyouni

Reputation: 3252

How to add a method to a 3rd party library

I want to add drawerItem.getName() to MaterialDrawer Library in which the method get the name of the drawer item

How can add this method in my code to be used? or request it from the developer on GitHub?

Upvotes: 0

Views: 49

Answers (2)

Orest Savchak
Orest Savchak

Reputation: 4569

Actually, BaseDrawerItem has it already and return StringHolder reference. You can use it as ((BaseDrawerItem)drawerItem).getName().getText().

Upvotes: 2

Gabe Sechan
Gabe Sechan

Reputation: 93668

Your options are:

1)download the library and alter it directly, rather than using gradle. You'll have to keep this file up to date with every new version you use of the library.

2)Fork that class under a new name and maintain it yourself. You'll need to keep this up to date or accept that bug fixes/features will not be added.

3)You can request the maintainer of the library to add it. Usually it helps if you do the work. For some random library on github it may or may not ever happen, depending on if the library is abandoned or not, wether the maintainer(s) care or not, and whether they think its a good idea.

Upvotes: 2

Related Questions