butterknife

Android Studio: Integrating Butterknife?

梦想与她 提交于 2019-12-03 11:51:35
I am trying to implement Butterknife into my android studio project. However when I do so I get an error on @InjectView "cannot resolve symbol InjectView". Have I not implemented Butterknife sucsessfully? Activity code: package com.example.rodf.testapp; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; public class MainActivity extends ActionBarActivity { @InjectView(R.id.tvHelloWorld) TextView tv1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R

How to use ButterKnife inside adapter

 ̄綄美尐妖づ 提交于 2019-12-03 11:04:35
I would like to use ButterKnife to bind my views inside listView adpater. I tried this, but i can not simply use my "spinner" var. public class WarmSpinnerAdapter extends ArrayAdapter<Warm> { Context context; public WarmSpinnerAdapter(Context context, int resource, Warm[] objects) { super(context, resource, objects); } @Override public View getView(int position, View convertView, ViewGroup parent) { View v = LayoutInflater.from(context).inflate(R.layout.item_spinner, null); return v; } @OnClick(R.id.spinner) public void onClick() { //open dialog and select } static class ViewHolder { @BindView

Butterknife is unable to bind inside my Adapter Class

独自空忆成欢 提交于 2019-12-03 10:32:36
I have an Adapter that draws the layouts for my Navigation Drawer. My navigation drawer contains two inner xml files: One being the Header and the other being the Row . I draw these out in a single adapter, but when I'm trying to setText() on my header, I get failure to bind. Here is my adapter class: public class DrawerAdapter extends RecyclerView.Adapter<DrawerAdapter.ViewHolder> { private static final int HEADER_TYPE = 0; private static final int ROW_TYPE = 1; private static Context context; private static DatabaseHelper databaseHelper; private List<String> rows; private List<Integer> icons

Obsfucation + Butterknife/Databinding

匿名 (未验证) 提交于 2019-12-03 10:24:21
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I currently use Butterknife to inject views into my code. I noticed class names are not obsfucated when i use minifyenabled, since butterknife needs the correct class name to generate the proxy classes that will do the binding. (MainActivity.class -> MainActivity_ViewBinding.class) I'm willing to switch to the "new" Data Binding Library in android studio. But since it's a lot of work considering my project is huge, here's my question: Will the Data Binding Library also not obsfucate the classes? Will switching from butterknife affect

Android Butterknife - binding in fragment

ぐ巨炮叔叔 提交于 2019-12-03 09:18:41
I'm using Butterknife for the first time but something must be wrong. I have a fragment and a Listview and a TextView just for testing but Butterknife wont bind my variables: public class MyFragment extends Fragment { @Bind(R.id.resultListView) ListView resultList; @Bind(R.id.textView1) TextView test; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_my, container, false); ButterKnife.bind(this, view); System.out.println(resultList); //null System.out.println(view.findViewById(R.id

Why do I have problems whith &#039;com.jakewharton:butterknife:7.0.1&#039; in Android Studio 3.0?

匿名 (未验证) 提交于 2019-12-03 09:14:57
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: 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

Geeting null when i use BindView in Butterknife

这一生的挚爱 提交于 2019-12-03 09:11:14
Here my topActivity which extend BaseActivity activity_top.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="schemas.android.com/apk/res/android"; android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <View android:id="@+id/activity_top_group_area1" android:layout_width="wrap_content" android:layout_height="match_parent"/> </LinearLayout> TopActivity.java public class TopActivity extends BaseActivity { @BindView(R.id.activity_top_group_area1) View mViewClickArea1; @Override protected void onCreate(Bundle

Where should I unbind ButterKnife 8.x.x in a ViewHolder?

邮差的信 提交于 2019-12-03 06:38:59
问题 I have a RecycleView.ViewHolder class which use ButterKnife annotations. Should my code unbind() in this ViewHolder class too? public class AView extends RecyclerView.ViewHolder { @BindView(R.id.a_text_view) TextView aText; public AView(final View view) { super(view); ButterKnife.bind(this, view); // It returns an Unbinder, but where should I call its unbind()? } } The docs (http://jakewharton.github.io/butterknife/) does not talk about this issue. 回答1: According to Jake Wharton, author of

Bind ButterKnife to Dialog fails

旧时模样 提交于 2019-12-03 06:03:54
I try to bind ButterKnife to a AleterDialog that i made with a DialogBuilder method And exist this method ButterKnife.bind(Object,Dialog); but dosen't work for me import android.support.v4.app.DialogFragment; import android.support.v7.app.AlertDialog; public class NewUserDialogFragment extends DialogFragment { @Bind(R.id.textuserAccount) EditText textuserAccount; @Bind(R.id.textPassword) EditText textPassword; @Bind(R.id.nauta_domains) Spinner nauta_domains; @Bind(R.id.manualConfig) View manualConfig; @Bind(R.id.checkViewPass) CheckBox checkViewPass; @NonNull @Override public Dialog

Duplicate files while including butterknife with gradle

倖福魔咒の 提交于 2019-12-03 05:21:02
I have a basic Android app that I created with Android Studio, and I'm having problems adding butterknife to my build. I get this error: Error:: duplicate files during packaging of APK C:\apps\orion\app\build\apk\app-debug-unaligned.apk Error:Execution failed for task ':app:packageDebug'. > Duplicate files copied in APK META-INF/services/javax.annotation.processing.Processor File 1: C:\Users\andres\.gradle\caches\modules-2\files-2.1\com.jakewharton\butterknife\4.0.1\f43b36925363701633d01adb8e54df7150397a78\butterknife-4.0.1.jar File 2: C:\Users\andres\.gradle\caches\modules-2\files-2.1\com