Created
December 23, 2014 20:35
-
-
Save emedinaa/dbbef3d57471e61a2359 to your computer and use it in GitHub Desktop.
Example Butter Knife
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://jakewharton.github.io/butterknife/ | |
//activity | |
public class MyActivity extends Activity | |
{ | |
@InjectView(R.id.ibuClose) ImageButton ibuClose; | |
@InjectView(R.id.lviMyAlerts) ListView lviMyAlerts; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) | |
{ | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.my_activity); | |
ButterKnife.inject(this); | |
} | |
} | |
//fragments | |
public class MyFragment extends Fragment | |
{ | |
@InjectView(R.id.txtUser) | |
EditText txtUser; | |
@InjectView(R.id.txtPassword) | |
EditText txtPassword; | |
@Override | |
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | |
v = inflater.inflate(R.layout.my_fragment, container, false); | |
ButterKnife.inject(this, v); | |
return v; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment