Skip to content
tylertreat edited this page Dec 31, 2012 · 2 revisions

InfinitumFragment is an extension of Android's Fragment which takes care of framework initialization, provides support for dependency injection, and exposes an InfinitumContext.

When building a Fragment that relies on Infinitum, it's typically good practice to extend InfinitumFragment rather than manually configuring the framework through the ContextFactory. InfinitumFragment also allows you to perform bean autowiring within the Fragment. Currently, it does not support layout, resource, or view injection, nor does it support event binding. However, these features are planned for a future release.

Using an InfinitumFragment requires the Android Support Library for platforms below Android 3.0.

InfinitumFragment Example

public class MyFragment extends InfinitumFragment {

    @Autowired
    private MyBean mMyBean;

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        InfinitumContext context = getInfinitumContext();
        mMyBean.doStuff(context);
    }

}

Clone this wiki locally