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
1 answer

ButterKnife error when using in Fragment

I'm using ButterKnife library in my android application. It works fine in Activities. But when I use that in Fragment it give me an error while building the project. Here is my code : package com.foxastudios.stopnosocomials.Fragments; public class…
Sathindu
  • 407
  • 1
  • 5
  • 21
0
votes
1 answer

Reading build/outputs/logs File from Gradle/Android Studio

I noticed my Android app was requesting to "Prevent phone from sleeping" when users installed it. I know I didn't add in any Wake_Lock but figured one of the 3rd party libraries did. After some googling, I found that I can find the merged Manifest…
0
votes
4 answers

ButterKnife 8.0.1 @OnClick not working in Fragment - Android Studio

I am using ButterKnife 8.0.1 in my android studio project. Below is my gradle file and snippet of fragment class. I am unable to see Toast message in button click. But I am able to see Toast if I use onCLicklistener . Please help me find out what I…
Hitesh Sahu
  • 41,955
  • 17
  • 205
  • 154
0
votes
1 answer

RuntimeException: Unable to start activity ComponentInfo, NotFoundException

I'm trying to learn Retrofit 2 with this basic example. And I got a problem while trying to pass serializable data from activity to activity... Have you got any idea why? This is my code. logcat: 05-24 00:21:46.215…
y07k2
  • 1,898
  • 4
  • 20
  • 36
0
votes
1 answer

Duplicate file exception between Butterknife and Realm after adding Realm depecendency

Am trying to add Realm to my project but when running I get the following build error from gradle: Error:Execution failed for task ':sdksampleapp:transformResourcesWithMergeJavaResForDebug'. > com.android.build.api.transform.TransformException:…
Orbit
  • 2,985
  • 9
  • 49
  • 106
0
votes
0 answers

ButterKnife 8 null pointer exception

I have never had a problem using butter knife until now. I'm assuming it has something to do with the jump from version 7 to 8. This keeps throwing a null pointer exception when I try to set the text. It is inside an activity. Also an @OnClick is…
Sam M
  • 640
  • 1
  • 8
  • 18
0
votes
2 answers

NullPointerException with using ButterKnife

I enable annotation processing like this and follow this code: public class MainFragment extends Fragment implements WeatherUpdater.AsyncResponse { @BindView(R.id.temperature_max) TextView temperature_max; @Override public View…
D. Wayne
  • 173
  • 1
  • 1
  • 8
0
votes
0 answers

How to set onClickListener for all fields through one loop using reflection?

I would like to set the same onClickListener for all items in my activity. Is it possible to do it with loop? I was trying with reflection, unfortunately without success. My code: private void setUpOnClickListeners() { Field[] fields =…
0
votes
2 answers

I am working on a project by some other developer ? Can i remove Butterknife library?

he was using butterknife to bind controls? I need to know will removing butterknife result in a reduced size to the apk as i need to shrink the apk. Also if possible please mention the pro and cons of using it .
Samar
  • 21
  • 1
  • 5
0
votes
1 answer

how to Bind dynamic views using butterknife

i am creating the multiple dynamic views in android and my fragment using the layout of parent fragment and in child fragment i am creating the dynamic views but i am not able to bind those dynamic views using Butterknife. @Override public View…
anoop ghildiyal
  • 821
  • 10
  • 18
0
votes
1 answer

Unable to bind views for .. $RecyclerViewHolders at ButterKnife.bind(this, itemView); in RecyclerViewHolders

I am getting below error log: java.lang.RuntimeException: Unable to bind views for .. $RecyclerViewHolders at butterknife.ButterKnife.bind(ButterKnife.java:322) at…
pRaNaY
  • 24,642
  • 24
  • 96
  • 146
0
votes
0 answers

How can I assign ButtKnife @OnClick to two different views with the same id?

For example, Assume that I have 2 buttons with the same ID in two different fragment layouts. layout1 - myButtonAction layout2 - myButtonAction In the parent activity if I do this: @OnClick(R.id.myButtonAction) public void doSomething() { // Only…
trancer
  • 135
  • 1
  • 7
0
votes
0 answers

Converting an existing app using ButterKnife to an Android library

I have this moderately massive application which I have to turn into an Android library. My application extensively depends on ButterKnife, and as per it's limitations I can't use ButterKnife anymore. An alternative to this is using ButterFork. My…
iZBasit
  • 1,314
  • 1
  • 15
  • 30
0
votes
0 answers

My Android app looks good on my emulator, looks aweful on my phone

I am currently working on an Alarm app for my phone. I started the app on my Genymotion emulator on my PC, and it looks like i want it too: https://i.stack.imgur.com/qSRDB.jpg However, when I start it on my phone via android studio it looks like…
0
votes
1 answer

Butter Knife @bind in Fragment Attempt to invoke virtual method

After the problems were resolved. (enter link description here) I found a new problem attempt to invoke virtual method. error : java.lang.RuntimeException: Unable to start activity ComponentInfo: java.lang.NullPointerException: Attempt to invoke…
Rufio Rocco
  • 121
  • 1
  • 6