Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class EstadoActual extends Fragment {
- // this controls work perfect
- @InjectView(R.id.txtWork1) AutoCompleteTextView txtWork1;
- @InjectView(R.id.txtWork2) EditText txtWork2;
- // this controls are inside the viewstub,
- @InjectView(R.id.viewstub) ViewStub viewStub;
- MyDynamicView myDynamicView;
- .. .. ...
- // class (inner in this example) that has stuff from your stub
- public class MyDynamicView {
- @InjectView(R.id.txtDontWork1) EditText txtDontWork1;
- @InjectView(R.id.txtDontWork1) EditText txtDontWork2;
- public MyDynamicView(View view) {
- Butterknife.inject(this, view);
- }
- }
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
- View rootView = inflater.inflate(R.layout.festadoactual, container, false);
- ButterKnife.inject(this, rootView);
- ... ..
- View viewFromStub = viewStub.inflate();
- myDynamicView = new MyDynamicView(viewFromStub); // this is the main point where you configure your view
- Fill();
- return rootView;
- }
- private void Fill(){
- txtWork1.setText("Hello 1");
- txtWork2.setText("Hello 2");
- myDynamicView.txtDontWork1.setText("Don't Work 1"); // This should work for you now
- myDynamicView.txtDontWork2.setText("Don't Work 2");
- }
Add Comment
Please, Sign In to add comment