I've installed ButterKnife
my build.gradle
looks like this:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.jakewharton:butterknife:8.4.0'
}
My loginActivity looks like this:
package com.example.egen.forum;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.Toast;
import butterknife.ButterKnife;
import butterknife.OnClick;
public class LoginActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
ButterKnife.bind(this);
Toast.makeText(getApplicationContext(), "Your toast message.",
Toast.LENGTH_SHORT).show();
}
@OnClick(R.id.btnLogin) public void test() {
Toast.makeText(getApplicationContext(), "Your toast message.",
Toast.LENGTH_SHORT).show();
}
}
The second toast does not show up. What am I doing wrong here?