butterknife

Bound view is null when using Butterknife in fragment

ぃ、小莉子 提交于 2019-12-06 10:16:55
I am using Butterknife to bind a single view in one of my fragments. I have used Butterknife with no issue in a separate fragment, but for some reason in this fragment the bound view is null. I am trying to add a child layout to it and I am receiving a NPE and I cannot figure out why. The setup I have in this fragment is the same as I have in my other fragment that works perfectly. This is a snippet from the fragment including the Butterknife code. private View view; @BindView(R.id.layoutHolder) LinearLayout layoutHolder; public View onCreateView(LayoutInflater inflater, ViewGroup container,

Subscriber not getting fired when using Otto

筅森魡賤 提交于 2019-12-06 07:44:53
问题 I'm trying out Otto on Android and i'm trying to send back a message from my Fragment to the Activity. Here's the basics of my code: My Bus provider: public final class BusProvider { private static final Bus mInstance = new Bus(); private BusProvider() {} public static Bus getBusProviderInstance() { return mInstance; } } My Activity has the following code: public class MyActivity extends BaseActivity { // .... @Override public void onCreate(Bundle savedInstanceState) { super.onCreate

Butterknife with Different Layouts for Phones and Tablets

冷暖自知 提交于 2019-12-06 07:31:16
问题 I am having a bit of an issue with using the Butterknife library in my current project. I am currently optimizing the project for both phones and tablets and there are sometimes slight differences between the layout files for the two for example layout/layout_example.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <TextView android:id="@+id/text1" android

butterknife zelezny can't show in generate menu for AndroidStudio1.3.1

孤人 提交于 2019-12-05 19:04:12
My Android studio version is 1.3.1, When I add the plugin of butterknife zelezny 1.3.2 by the step: download it and install via Preferences → Plugins → Install plugin from disk. but, failed to show the button of "Generate ButterKnife Injections" in the menu of generate. what's reason of this issue? How can resolve it? Thanks. restart your AS right click on R.layout.my_layout choose generate(or click Alt+Insert) you may see "generate Butterknife injections" item in the menu I also faced the same .So if am correct you have not added butter knife dependencies in your gradle file. dependencies {

Butter Knife won't inject

最后都变了- 提交于 2019-12-05 18:19:54
I'm trying to use Butter Knife at Android Studio these days, yet it fails me with some odd problems. I used to try Butter Knife at eclipse, and it worked fine. I don't know if I configured something wrong at Android Studio. I followed instructions at Jake Wharton's website , yet it's still not working. At first, It could be compiled and installed, but after Butterknife.inject(this) , the view would still be null, and it threw a null pointer error. Then I googled how to configure Butterknife at Android Studio, and followed this issue at stackoverflow, it could not pass compilation then. Then I

Bind with Butterknife to dynamically added view in android

故事扮演 提交于 2019-12-05 15:18:55
How Can I bind the views present inside the Layout which is dynamically added to the parent view with ButterKnife. I have a LinearLayout say container . And I have a custom layout which contains two buttons say this layout as childview In activity I added the childview successfully to the parent LinearLayout container . This is how I did to inflate the custom view and added to the LinearLayout bubbleView = inflater.inflate(R.layout.child, null); systemChatLayoutContainer.addView(bubbleView); Now I want to bind the Button views present inside the child layout and add perform some action when

Android Studio: ButterKnife 6.1.0 Duplicate Class: $$View Injector

巧了我就是萌 提交于 2019-12-05 14:34:32
I migrated my project to AS from Eclipse as I was getting 65K methods issue. After fixing every dependency issue that I was facing initially with AS, I got stuck with this issue which doesn't seem to go away no matter what I try from the other similar posts from around the blogs and SO itself. I checked Enable Annotation Processing in Annotation Processors and also gave a processor path. (even tried with Obtain processor from project classpath) but whenever I run the project it gives the following error: Error:(8, 8) error: duplicate class: list.EventsListAdapter$ViewHolder$$ViewInjector Error

Why do I have problems whith 'com.jakewharton:butterknife:7.0.1' in Android Studio 3.0?

喜欢而已 提交于 2019-12-05 12:12:00
I have the following problem when I run the 'app' (Android studio emulator): Error:Execution failed for task ':app:javaPreCompileDebug'. > Annotation processors must be explicitly declared now. The following dependencies on the compile classpath are found to contain annotation processor. Please add them to the annotationProcessor configuration. - butterknife-7.0.1.jar (com.jakewharton:butterknife:7.0.1) Alternatively, set android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true to continue with previous behavior. Note that this option is deprecated and

Butter Knife return null pointer

风流意气都作罢 提交于 2019-12-05 11:47:53
问题 I want to using Butter Knife in my project.I did everything according to the Butter Knife tutorial. But when I set anything to the views (setText, setClickListener ...) I got null object reference exception. This is my code: public class LoginActivity extends AppCompatActivity implements LoginView, View.OnClickListener { @BindView(R.id.acEtUsername) AppCompatEditText userName; @BindView(R.id.acEtPassword) AppCompatEditText password; @BindView(R.id.prgCheckLogin) ProgressBar prgCheckLogin;

Layout fields of fragment are NULL on initialization

吃可爱长大的小学妹 提交于 2019-12-05 11:33:18
I have issue with passing data to fragments. It crashes 0.1% of all times on production. Let's say on 100k opening of activity it happens 100 times. It looks like not very often, but it very bothering me and I think that I am doing something wrong with fragments initialization with data. The thing is, that I create fragments only one time, and all other times I need to pass data to them I am doing it next way: myFragmentInstance.setData(Object someData); And crash happens because it tells that those view elements in fragment are not found and they are NULL, but everything should be fine if I