Back to project page template-android.
The source code is released under:
MIT License
If you think the Android project template-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.org.application.ui.activity; /*from w w w .j a va 2 s . c om*/ import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.widget.Button; import android.widget.Toast; import com.org.application.App; import com.org.application.R; import com.org.application.mock.IFoo; import javax.inject.Inject; import butterknife.ButterKnife; import butterknife.InjectView; import butterknife.OnClick; /** * */ public class MainActivity extends Activity { private static final String TAG = MainActivity.class.getSimpleName(); @Inject IFoo mFoo; @InjectView(R.id.sampleButton) Button mSampleButton; @OnClick(R.id.sampleButton) void toast(){ Toast.makeText(this, "ButterKnife! " + mFoo.printFoo(), Toast.LENGTH_SHORT).show(); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); App app = App.get(this); app.inject(this); setContentView(R.layout.activity_main); ButterKnife.inject(this); mSampleButton.setText("Toast ButterKnife!"); Log.d(TAG, "I am debugging."); } }