The gen Directory File - dummies

By Barry Burd

The directory name gen stands for generated. The gen directory contains This listing shows that part of the file generated for you when you create a brand-new project.

 * This class was automatically generated by the
 * aapt tool from the resource data it found.  It
 * should not be modified by hand.
package com.example.myfirstandroidapp;
public final class R {
    public static final class attr {
    public static final class drawable {
        public static final int ic_launcher=0x7f020000;
    public static final class id {
        public static final int menu_settings=0x7f070000;
    public static final class layout {
        public static final int activity_main=0x7f030000;
    public static final class menu {
        public static final int activity_main=0x7f060000;
    public static final class string {
        public static final int app_name=0x7f040000;
        public static final int hello_world=0x7f040001;
        public static final int menu_settings=0x7f040002;
    // ... (There’s more!)

The values in are the jumping-off points for the resource management mechanism in Android. Android uses these numbers for quick and easy loading of the items you store in the res directory.

You can’t make changes to the file. Long after the creation of a project, Android continues to monitor (and, if necessary, update) the contents of the file. If you delete, Android re-creates the file. If you edit, Android undoes the edit.

If you answer Yes in the dialog box named Do You Really Want to Edit This File?, Eclipse accepts the change — but immediately afterward, Android clobbers your change.