ButterKnife 7.0 BindString in class that don't have a View

I am using @BindString from ButterKnife 7.0 in a helper class that don't have any view.

The bind methods from Butter Knife are:

bind(Activity target)
bind(View target)
bind(Dialog target)
bind(Object target, Activity source)
bind(Object target, View source)
bind(Object target, Dialog source)

As you can see, there are no method that allow me to do the bind without a View object.

I can get any activity and pass it to the class to make the bind, but this is hacky and will add an unnecessary dependency to my class.

There is any way to make Butter Knife binding without a View?

Answers


To access (string) resources you need a Context. A View has a reference to the context that created it.

I don't see how you can bind a string without a context.

Update: See this issue on Github


Need Your Help

visual studio extension (VSPackage) add items to Test Explorer context menu

visual-studio unit-testing vspackage

I am writing an extension to Visual studio 2012 using VSPackage. I need to add a context menu entry to Test Explorer and on click of this menu item, I need to get the selected unit test(s). I tried...

How do I Understand Read Memory Barriers and Volatile

multithreading volatile memory-barriers

Some languages provide a volatile modifier that is described as performing a "read memory barrier" prior to reading the memory that backs a variable.