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 is not initializing views in AOSP marshmallow but works fine in lollipop

I am using butterknife library in my project. It works fine in when I build in Lollipop AOSP but the same code initializes nothing and so after that NPE is thrown in Marshmallow AOSP. Here is the code: public class ErrorLayoutViewHolder extends…
0
votes
2 answers

Butter Knife and Material Design Library usage

I am using Butter Knife in my project along with the Material Design Libraries for the UI. When attempting to create buttons using the Material Design Library i get a 'Class Cast Exception' because of the usage of Butter Knife. Is there a way to fix…
Perfect_Comment
  • 165
  • 1
  • 2
  • 15
0
votes
1 answer

Set text to textview returns null in android code

I am trying to set a text for my textview every time I update the user interface. public class CourseDetailsFragment extends Fragment { private static final String TAG = "CourseDetailsFragment"; private OnFragmentInteractionListener listener; …
RockNova
  • 161
  • 1
  • 1
  • 10
0
votes
1 answer

Is Butterknife.findById() better than findViewById()?

Does using ButterKnife.findById() offer any sort of performance increase over using findViewById()? I'm guessing no--and this it's made for simplification of code only.
Nxt3
  • 1,970
  • 4
  • 30
  • 52
0
votes
1 answer

Binding views in a recycler view inside a fragment

So I'm trying to get a menu button working on top of my recycler view, however I'm getting the error 02-01 17:33:53.946 8212-8212/lucas.app_2001 E/AndroidRuntime: java.lang.RuntimeException: Unable to bind views for lucas.app_2001.OneFragment I…
0
votes
0 answers

Passing parameters to onClick handler using Butterknife

I want to handle onClick event for specific view, and pass some parameters to handler. Right now I have created a function and passing View and my params to that function and implementing onClick handler in that function as follows. private void…
Kishor Pawar
  • 3,386
  • 3
  • 28
  • 61
0
votes
1 answer

Android: Implement open source libraries or maintain own implementation?

I'm currently developing an Android app in which I've written my own implementation and/or used the Android SDK implementation for the following tasks: Asynchronously retrieving/posting data to a web service and storing to db JSON building and…
Thijs
  • 714
  • 9
  • 23
0
votes
1 answer

ButterKnife error: cannot find symbol method bind(MyActivity)

I recently switched to ButterKnife version 7.0.1 and I keep getting this error. It points to this part of the code: Here's the exact part of the code: public class SupportedBanksActivity extends AppCompatActivity { …
nsmirosh
  • 45
  • 2
  • 8
0
votes
1 answer

Android Butterknife create and inject views dynamically

public class Class1View extends LinearLayout{ @Override protected void onFinishInflate(){ super.onFinishInflate(); Butterknife.bind(this); } } How do I create a new view, for example, a new Button() and add it to this…
dcanh121
  • 4,665
  • 11
  • 37
  • 84
0
votes
0 answers

Android soft input - getting new line character when clicking 'done'

There is strange problem that I have come across, I have EditText like this
Max
  • 446
  • 4
  • 16
0
votes
1 answer

I get an IOException in Butterknife viewbinder code I can't edit

I am working in android studio, using the butterknife.jar. But right know it is throwing an IOException in uneditable code. I throw the exception in the code that calls the method like this: @OnClick(R.id.testButton) public void Test() throws…
JoeryJV
  • 103
  • 1
0
votes
1 answer

How to use butterknife to bind click event onto a view in a layout

As we all know,if we want to use Butterknife to bind click event onto a normal view,we just need to declare the below method: @onClick(R.id.yourview) public void submit(){ // do your things } But,how can I bind click event onto a view in a …
QuinnChen
  • 670
  • 1
  • 8
  • 29
0
votes
1 answer

@OnClick method within Adapter's ViewHolder doesn't point on the right list item

I recently witnessed a weird behaviour, when I used ButterKnife to bind an OnClick method of an image button inside an Adapter, as pointed in the title of this question. As suggested in the documentation I declared an inner class ViewHolder, where…
moud
  • 729
  • 9
  • 19
0
votes
1 answer

java.lang.NoClassDefFoundError using ButterKnife with Latest Android Studio

I just upgrade my Android Studio today and came across this error when compiling my project using ButterKnife 7.0.2-Snapshot. Caused by: java.lang.NoClassDefFoundError: android/view/View at…
brwngrldev
  • 3,664
  • 3
  • 24
  • 45
0
votes
2 answers

clicklisteners in a customview after onConfigurationChanged

I have this custom view that is being added to the WindowManager as a System Alert which should function as a fullscreen overlay to block certain parts of the phone when the app is running. This works great when the overlay is shown it blocks the…
Aegis
  • 5,761
  • 2
  • 33
  • 42