I've a roboactivity where I inject some stuff like resources and views. I use some fragment classes in my app. These fragments have to extend Fragment. Here is my stuff:
When a button is pressed I make a new fragment:
FragmentManager fragmentManager = getFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.content_frame,Fragment.instantiate(this,fragments[position]));
fragmentTransaction.commit();
My fragment looks like this:
public class MyLists extends Fragment {
@InjectView(R.id.myview)
private TextView myview;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
ViewGroup root = (ViewGroup) inflater.inflate(R.layout.my_lists_fragment, null);
MyRepo repo= new MyRepo ();
myview.setText(repo.getSomething());
return root;
}
}
The InjectView isn't working. I can't find the reason why it wont work. Can anybody help me solving this?