plz dont mark it as duplicate i didnt find solution is other post
im using butterknife in my proj im getting error as Attempt to invoke virtual method 'void android.widget.TextView.setText(java.lang.CharSequence)' on a null object reference
code:-
xml:--
<TextView
android:id="@+id/txt_terms"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/txt_terms"
android:textSize="12sp"
android:gravity="center"
android:visibility="visible" />
activity:-
@BindView(R.id.txt_terms)
TextView txtTerms;
@CallSuper
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.new_login_activity);
ButterKnife.bind(this);
txtTerms.setText("ss1");/////////error crash
this is my code
what i have tried :---if i do like this adding this txtTerms=findViewById(R.id.txt_terms); it doesnt give error
but what might be error in above code using butterknife
please help thanks in advance