Time for action - creating the FourBucketsActivity

Since we are working with a layout resource with only a GridView, and no ID reference, we're going to walk through the creation of the Activity step-by-step. Unlike previous Activity implementations, we will need a direct reference to the GridView defined in four_buckets.xml, and this means loading it manually.

  1. Start by creating a new class in your project's root package:
    public class FourBucketsActivity extends Activity {
  2. Override the onCreate method, and invoke the super implementation:
    protected void onCreate(final Bundle istate) { super.onCreate(istate);
  3. Get the LayoutInflator instance for your Activity object:
    LayoutInflater inflater = getLayoutInflater();
  4. Inflate the four_buckets.xml resource ...

Get Android User Interface Development now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.