butterknife

Butter Knife @bind in Fragment error

半世苍凉 提交于 2020-01-14 09:43:09
问题 I follow the instructions on the website : http://jakewharton.github.io/butterknife/ error : java.lang.RuntimeException: Unable to start activity ComponentInfo. java.lang.RuntimeException: Unable to bind views for com.project.myapp.OneFragment. I try to remove @Bind(R.id.btnNext) Button btnNext; and run no error. public class OneFragment extends Fragment { @Bind(R.id.btnNext) Button btnNext; private static final String ARG_PARAM1 = "param1"; private static final String ARG_PARAM2 = "param2";

Butterknife custom view unbind

[亡魂溺海] 提交于 2020-01-13 08:07:35
问题 What's the best practice for calling : - Butterknife.unbind() in a custom Android view please? 回答1: Yes, onDetachedFromWindow is the right function as mentioned in NJ's answer because this is where view no longer has a surface for drawing. But the usage is incorrectly mentioned in the answer. The right approach involves binding in onFinishInflate() : @Override protected void onFinishInflate() { super.onFinishInflate(); unbinder = ButterKnife.bind(this); } and unbinding in onDetachedFromWindow

Butterknife custom view unbind

时光怂恿深爱的人放手 提交于 2020-01-13 08:07:10
问题 What's the best practice for calling : - Butterknife.unbind() in a custom Android view please? 回答1: Yes, onDetachedFromWindow is the right function as mentioned in NJ's answer because this is where view no longer has a surface for drawing. But the usage is incorrectly mentioned in the answer. The right approach involves binding in onFinishInflate() : @Override protected void onFinishInflate() { super.onFinishInflate(); unbinder = ButterKnife.bind(this); } and unbinding in onDetachedFromWindow

【Android Studio】 常用插件

≡放荡痞女 提交于 2020-01-06 17:57:51
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 一、代码相关 1、Android ButterKnife Zelezny 在 Activity,Fragment,Adapter 中选中布局 xml 自动生成 butterknife 注解。 2、GsonFormat&JsonFormat 快速将json字符串生成相应的实体类。 3、SelectorChapek 设计师给我们提供好了各种资源,每个按钮都要写一个selector是不是很麻烦? 这个插件就为解决这个问题而生,你只需要做的是告诉设计师们按照规范命名就好了,其他一键搞定。 按照不同状态(normal、pressed)的标准命名后,右键文件树 Generate Android Selectors 参考 https://github.com/inmite/android-selector-chapek 4、Android Parcelable code generator Android中的序列化有两种方式,分别是实现Serializable接口和Parcelable接口。 但在 Android中是推荐使用 Parcelable,只不过我们这种方式要比 Serializable 方式要繁琐,那么有了这个插件一切就ok了。 5、Android Code Generator

Android:Use ButterKnife in Activity extending from another activity

假装没事ソ 提交于 2020-01-03 19:15:14
问题 I wanted navigation drawer in all my activities.So i used a BaseActivity for Navigation drawer and extended other activities from base activity.Base activity has Navigation drawers. Dashboard activity is extending base activity but it raises exception when i try to use butterknife to bind views saying java.lang.IllegalStateException: Required view 'dashboard_frameLayout' with ID 2131558517 for field 'frameLayout' was not found. here are the relevant files BaseActivity.java public class

@OnClick is not working in implementation of ButterKnife Library

泄露秘密 提交于 2020-01-03 13:57:06
问题 @OnClick is not working in implementation of ButterKnife Library When I click on the Button , nothing is happening. This is my full code: public class MainActivity extends ActionBarActivity { @InjectView(R.id.edit_user) EditText username; @InjectView(R.id.edit_pass) EditText password; @OnClick(R.id.btn) void submit() { // TODO call server... } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ButterKnife

Butterknife 8.1.0 not working with JDK 1.8 in Android Studio 2.1.2

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-02 03:14:08
问题 I'm fairly new to Android, Android Studio, Butterknife and the Gradle build system. However, I'm not new to Java, or programming in general. I'm trying to build an Android app with JDK 1.8 and Butterknife version 8.1.0 , but the Gradle build keeps failing, saying: Error:Could not find property 'options' on task ':app:compileDebugJavaWithJack'. Note: My project was working perfectly fine with JDK 1.8 (except for the "Instant Run" functionality) until I tried adding Butterknife. I've already

View null inside fragment

大憨熊 提交于 2019-12-31 05:24:07
问题 I've been working on this for hours now. Can't find any reason. I can't post the entire fragment here but the following should make it clear. @BindView(R.id.acService) AutoCompleteTextView autocompleteService; @BindView(R.id.acAddress) AutoCompleteTextView autocompleteAddress; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_home, container, false); unbinder = ButterKnife.bind(this,

Buttknife not working with RXJava

主宰稳场 提交于 2019-12-25 08:37:34
问题 Have problems with two libraries. Gradle file apply plugin: 'com.android.application' android { compileSdkVersion 25 buildToolsVersion "25.0.3" defaultConfig { applicationId "pe.com.gmd.innova.adexus.adexusday" minSdkVersion 16 targetSdkVersion 25 versionCode 1 versionName "1.0" multiDexEnabled true testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" jackOptions { enabled true } } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard

How to solve NullPointerException void com.google.android.gms.ads.AdView.loadAd(com.google.android.gms.ads.AdRequest) with Butterknife

房东的猫 提交于 2019-12-25 07:14:42
问题 Actually, I am trying to make an app with free and paid flavors. When I use simple findViewById method to bind then it works fine. But when I trying to add butterKnife, I desperately stuck with butterKnife. I am trying to bind content (such as AdMob OR Button) by butterknife bind in MainActivity.java file. but it shows Nullpointer exception error first it shows on AdMob object nullpointer exception. I run clean project then it shows on button.onClickListener Nullpointer exception. Please help