I downloaded the ButterKnife library, installed the plugin, like on the plugin's website. As a result, I get NullPointerExeption.
Is there any plugin on the Internet that, according to R.layout.main will create in the Java class all the id elements?
Button , ListView , etc. like the ButterKnife plugin, only it doesn't work for some reason.
It gives an error
java.lang.RuntimeException: Unable to start activity ComponentInfo{com../com...Activites.News1}: java.lang.NullPointerException Caused by: java.lang.NullPointerException at com...Activites.News1$override.onCreate(News1.java:36) at com...Activites.News1$override.access$dispatch(News1.java) at com...Activites.News1.onCreate(News1.java:0) Here is the code of the programm itself.
public class News1 extends AppCompatActivity{ String textShare = ""; boolean tabLikeBool = false; @BindView(R.id.tab_like) TextView tabLike; @BindView(R.id.tab_msg) TextView tabMsg; @BindView(R.id.tab_share) TextView tabShare; // TextView tabLike,tabMsg,tabShare; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.news1); ButterKnife.bind(this); // tabLike= (TextView) findViewById(R.id.tab_like); tabLike.setOnClickListener(this); // tabMsg= (TextView) findViewById(R.id.tab_msg); tabMsg.setOnClickListener(this); // tabShare= (TextView) findViewById(R.id.tab_share); tabShare.setOnClickListener(this); tabLike.setText("4"); getSupportActionBar().setDisplayHomeAsUpEnabled(true); } Here's the compile 'com.jakewharton:butterknife:8.1.0'
Why does everyone work? I don't have