You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
AssemblyJohn edited this page Oct 9, 2014
·
5 revisions
View infusion
View infusion is quite simple. Instead of using findViewById() and cast the returned object to the desired type just use @InfuseView with the desired resource id.
All you have to do is to extend InfuseActivity.
public class MainActivity extends InfuseActivity {
@InfuseView(R.id.textView1)
private TextView mHelloWorld;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public void onContentChanged() {
super.onContentChanged();
mHelloWorld.setText("Goodbye world!");
}
}
Without view infusion:
public class MainActivity extends InfuseActivity {
private TextView mHelloWorld;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public void onContentChanged() {
super.onContentChanged();
mHelloWorld.setText("Goodbye world!");
}
}