Questions tagged [butterknife]

An annotation-based Android view "injection" framework aimed at reducing boilerplate.

View "injection" library for Android which uses annotation processing to generate boilerplate code for you.

  • Eliminate findViewById calls by using @Bind on fields.
  • Group multiple views in a list using @BindViews. Operate on all of them at once with actions, setters, or properties.
  • Eliminate anonymous inner-classes for listeners by annotating methods with @OnClick and others.

The documentation includes additional code examples and use cases.

ButterKnife is open sourced under Apache 2.0 license.

536 questions
0
votes
0 answers

Using MrVector with Butter Knife

The app I'm working uses vector images, and I'm trying to implement pre-API 21 support for them using MrVector. I'm aware that variables can't be passed into @InjectView() - is there any way of working around this?
CiaranC94
  • 176
  • 4
  • 20
0
votes
1 answer

Injecting view in a listener not working with Butterknife

To avoid "inner class hell" in case of Android event listeners, I have moved the listeners to separate classes. Following is one of such listeners for a TextView which holds a date string. On touching it, I open a DatePickerDialog and set the…
TechSpellBound
  • 2,505
  • 6
  • 25
  • 36
0
votes
1 answer

Android on EditText change enter key for submit Butterknife

I am using Butterknife and trying to change on EditText the enter for a…
agusgambina
  • 6,229
  • 14
  • 54
  • 94
0
votes
3 answers

ButterKnife does not injects views for MyFragment

Something is wrong with ButterKnife injection. Upon starting my app, I'm getting below error: 01-23 11:35:36.229 23663-23663/lt.andro.myapp E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: lt.andro.myapp, PID: 23663 java.lang.RuntimeException:…
ViliusK
  • 11,345
  • 4
  • 67
  • 71
0
votes
1 answer

Dagger and ButterKnife - Can i inject Android AudioManager instance

How do i inject an AudioManager instance ? I need a context and i dont have one ? Here is my class that uses a Dagger injection: public abstract class ListPageActivity extends BaseActivity { private SoundPool mSoundPool; private int…
j2emanue
  • 60,549
  • 65
  • 286
  • 456
0
votes
2 answers

Dagger for Android - cant define injection for class

I cant seem to use the injects word when trying to define classes that will use my injections. Here is my MainModule.java class: import dagger.Module; import dagger.Provides; @Module() public class MainModule { private Context context; …
j2emanue
  • 60,549
  • 65
  • 286
  • 456
0
votes
0 answers

EditText event call from all fragments

I want to know if I can save a block of code that I have written in all fragments of the app. The code in the fragment Nro 1 is this: public class Fragment1 extends Fragment { @InjectView(R.id.txtRP) EditText txtRP; public static Fragment1…
seba123neo
  • 4,688
  • 10
  • 35
  • 53
0
votes
0 answers

MonkeyTalk and Butterknife ViewInjector Generation - (Android + Annotations + AspectJ + Eclipse)

I have been using ButterKnife successfully to inject views in my application like so: @InjectView(android.R.id.text1) TextView mMessageText; @InjectView(android.R.id.button1) ImageView mButton; ... then later... View.inflate(ctx,…
frenziedherring
  • 2,225
  • 2
  • 15
  • 23
0
votes
1 answer

Dagger + ButterKnife = Could not initialize class dagger.internal.codegen.ModuleAdapterProcessor

I have a project where I'm using ButterKnife for view injection, and I just added dagger but I'm getting the following error: Description Resource Path Location Type Internal compiler error: java.lang.NoClassDefFoundError: Could not…
Shehabic
  • 6,787
  • 9
  • 52
  • 93
0
votes
1 answer

Setting the adapter on a Listview in a custom view injected with Butterknife

I have an Activity with a custom view in its Xml layout file:
DanielO
  • 145
  • 1
  • 12
0
votes
0 answers

Some how I broke butterknife

Some how I managed to break something in my eclipse setup that is breaking butterknife for any new views I try to inject. The "old" views still seem to be fine. This one works: @InjectView(R.id.sign_out_button) Button signOutButton; …
nPn
  • 16,254
  • 9
  • 35
  • 58
0
votes
0 answers

Android butter knife in a activity

I am just trying to use butter knife in my activity. Added the latest jar and run the application. But Nothing is working. Here is my code. Whats wrong in this @InjectView(R.id.buttonClick) Button buttonClick; @InjectView(R.id.textField) TextView…
user1002448
  • 425
  • 8
  • 22
0
votes
3 answers

Butterknife library not working with HoloEverywhere/Android bootstrap

I am currently coding on the Android Bootstrap app, I want to have the new DataPickers en make use of new widgets without worrying about porting back to 2.1+ so I use the HoloEveryWhere Library. I also use the Android Bootstrap with Butterknife…
-1
votes
1 answer

How can i use butterknife in android studio?

I'm using android studio 3.5. I have a problem in using butterknife. When I try to write @BindView(...) android studio does not autocomplete my code. When I write the code manually the android studio shows me the error: cannot resolve symbol…
-1
votes
2 answers

Butterknife @BindColor : How to pass param to method and set TextView Color?

Am I doing anything wrong ? I need to pass the integer variables that I have to the switch. This works (with numbers): @BindColor(R.color.white) protected int white; @BindColor(R.color.black) protected int black; Passing int value as…
Marcello Câmara
  • 187
  • 1
  • 13