This annotation can be used with classes inheriting/implementing:

  • android.app.Activity
  • android.app.Application
  • android.app.Fragment
  • android.app.Service
  • android.content.ContentProvider
  • android.support.v4.app.Fragment (with the spork-android-support dependency)
  • android.view.View
  • spork.android.ContextProvider
  • spork.android.ViewProvider

It can bind:

  • R.dimen.* to Float or float fields
  • R.string.* to String fields
  • R.integer.* to Integer and int fields
  • R.bool.* to Boolean and boolean fields
  • R.drawable.* to Drawable fields

You can bind a resource by specifying its id:

private String appName;

Alternatively, you can imply the view id by the field name:

private String app_name;


public class MyActivity extends Activity {

    private String appName;
    private String app_name;
    private float sporkTestDimension;
    private Float spork_test_dimension;
    private Drawable sporkTestDrawable;
    private Drawable spork_test_drawable;

    public void onCreate(Bundle savedInstanceState) {