title: Add fragment to frameLayout: Unable to find resource ID
body: <p>I have 3 frameLayout animated within these  I have to put the fragments, but the method I use does not work. Where am I doing wrong?</p>
  
  <pre><code>  11-28 11:18:41.979: E/AndroidRuntime(2263): java.lang.RuntimeException: Unable to start
    activity ComponentInfo{com.eni.mobilewf/com.eni.mobilewf.MenuActivity}: 
    android.content.res.Resources$NotFoundException: Unable to find resource ID #0x1
  </code></pre>
  
  <p>MenuActiviyt.java</p>
  
  <pre><code> public class MenuActivity extends FragmentActivity {
  
   static final int NUM_ITEMS = 3;
  
   public static MenuActivity menuActivity = null;
  
    public static ViewPager mPager;
    private Interpolator interpolator = new LinearInterpolator();
  
   private int width;
   private int panel;
   long animationDuration = 1000;
   ThreeLayout layout;
  
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      requestWindowFeature(Window.FEATURE_NO_TITLE);
  
  
      layout = new ThreeLayout(this, 3);
      layout.setAnimationDuration(1000);
      layout.setId(1234);
  
      layout.fl1.setId(0x11);
     layout.fl2.setId(0x22);
      layout.fl3.setId(0x33);
  
      FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();;
      Log.i("test", "transaction " +transaction);
  
      MenuFragment menu = new MenuFragment();
      ListFragment lista = new ListFragment();
       DetailFragment detail = new DetailFragment();
  
      Log.i("test", "id fl1 " +layout.fl1.getId());
      //id fl1 1
      Log.i("test", "id fl2 " +layout.fl2.getId());
      //id fl2 2
      Log.i("test", "id fl3 " +layout.fl3.getId());
      //id fl3 3
      transaction.add(layout.fl1.getId(), menu, "fragment1");
  
      transaction.add(layout.fl2.getId(), lista, "fragment2");
  
      transaction.add(layout.fl3.getId(), detail, "fragment3");
  
      transaction.commit(); 
  
  
      setContentView(layout);
      setupLayout();
  
  }   
  </code></pre>
  
  <p>ThreeLayout.java</p>
  
  <pre><code>public class ThreeLayout extends RelativeLayout {
  
  private int width;
  private int panel;
  public FrameLayout fl1;
  public FrameLayout fl2;
  public FrameLayout fl3;
  long animationDuration = 800;
  
  private Interpolator interpolator = new LinearInterpolator();
  
  public ThreeLayout(final Context context, final float leftWeight) {
      super(context);
      fl1 = new FrameLayout(context);
      fl2 = new FrameLayout(context);
      fl3 = new FrameLayout(context);
  
  
      post(new Runnable() {
          @Override
          public void run() {
              width = getWidth();
  
              panel = (int) (width / leftWeight);
  
  
              _initWithDimentionsPortrait(context);
          }
      });
  
  }
  
  private void _initWithDimentionsPortrait(Context context) {
  
  
  
      RelativeLayout container = new RelativeLayout(context);
      LayoutParams containerParams = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
      container.setLayoutParams(containerParams);
  
  
      containerParams.setMargins(0, 0, -width - panel, 0);
      Log.i("test", "la largezza è    "  +new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
  
      container.addView(fl1);
      container.addView(fl2);
      container.addView(fl3);
  
  
      LayoutParams params1 = new LayoutParams(panel, LayoutParams.FILL_PARENT);
      LayoutParams params2 = new LayoutParams(width - panel, LayoutParams.FILL_PARENT);
      LayoutParams params3 = new LayoutParams(width - panel, LayoutParams.FILL_PARENT);
  
      fl1.setLayoutParams(params1);
      params2.addRule(RelativeLayout.RIGHT_OF, fl1.getId());
  
      fl2.setLayoutParams(params2);
      params3.addRule(RelativeLayout.RIGHT_OF, fl1.getId());
  
      fl3.setLayoutParams(params3);
  
      addView(container);
  }
  </code></pre>
  
  <p>The fragment are not shown.Thanks in advance</p>