Example usage for android.widget FrameLayout setId

List of usage examples for android.widget FrameLayout setId

Introduction

In this page you can find the example usage for android.widget FrameLayout setId.

Prototype

public void setId(@IdRes int id) 

Source Link

Document

Sets the identifier for this view.

Usage

From source file:com.hellofyc.base.app.activity.SingleFragmentActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    FrameLayout layout = new FrameLayout(this);
    layout.setId(R.id.fragment_container);
    layout.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
            FrameLayout.LayoutParams.MATCH_PARENT));
    setContentView(layout);// w  w  w  .  j  av  a2 s .co m

    init();
    setActivityContent();
}

From source file:org.dronix.android.unisannio.activity.GBNewsActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    int tabnumber = -1;
    if (savedInstanceState == null) {
        Bundle extras = getIntent().getExtras();
        if (extras == null) {
            tabnumber = -1;/*from  w w w .j  a  va  2  s . co  m*/
        } else {
            tabnumber = extras.getInt("TABNUMBER");
        }
    }
    Fragment myFragment = null;
    switch (tabnumber) {
    case 0:
        myFragment = new TabOne();
        break;
    case 1:
        myFragment = new AvvisiIngFragment();
        break;
    case 2:
        myFragment = new TabThree();
        break;
    }

    if (tabnumber != -1) {
        // Create a frame layout, so we can add fragments to it.
        FrameLayout layout = new FrameLayout(this);
        layout.setId(0x1234);

        // Set the frame layout as the view container for this activity.
        setContentView(layout);

        // Create and add a fragment to frame layout created above.
        FragmentTransaction t = getSupportFragmentManager().beginTransaction();
        t.add(layout.getId(), myFragment, "myFirstFragment");
        t.commit();
    }
}

From source file:com.codeslap.topy.BaseSinglePaneActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    View rootView = getRootView();
    if ((getRootResource() != Integer.MIN_VALUE || rootView != null) && getRootResourceId() == ID) {
        throw new IllegalStateException("When overriding root view, you must also override getRootResourceId()"
                + " passing the ID of the view group where the content returned view onCreatePane will"
                + " be placed.");
    }/*w  w w .  ja  va 2s  . com*/
    if (getRootResource() != Integer.MIN_VALUE) {
        setContentView(getRootResource());
    } else if (rootView != null) {
        setContentView(rootView);
    } else {
        FrameLayout frameLayout = new FrameLayout(this);
        frameLayout.setId(getRootResourceId());
        setContentView(frameLayout);
    }
    setSupportProgressBarIndeterminateVisibility(false);

    if (savedInstanceState == null) {
        Fragment fragment = onCreatePane();
        fragment.setArguments(intentToFragmentArguments(getIntent()));

        String tag = fragment.getClass().getName();
        getSupportFragmentManager().beginTransaction().add(getRootResourceId(), fragment, tag).commit();
    }
}

From source file:android.arch.lifecycle.testapp.CollectingSupportActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    FrameLayout layout = new FrameLayout(this);
    layout.setId(R.id.fragment_container);
    setContentView(layout);//from   w  w w .ja  v  a2s .com
    mCollectedEvents.add(new Pair<>(OWNER_CALLBACK, Event.ON_CREATE));
    getLifecycle().addObserver(mTestObserver);
}

From source file:com.commonsware.android.arXiv.DownloadsActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    FrameLayout fl = new FrameLayout(this);
    fl.setId(android.R.id.content);
    setContentView(fl);/*from w  ww .  ja  v  a 2 s. com*/

    ActionBar ab = getSupportActionBar();
    ab.setTitle("History");
    ab.setDisplayHomeAsUpEnabled(true);
    ab.setHomeButtonEnabled(true);

    downloadsFragment = new DownloadsFragment();
    FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
    ft.add(android.R.id.content, downloadsFragment);
    ft.commit();
}

From source file:android.arch.lifecycle.testapp.CollectingSupportFragment.java

@Nullable
@Override/*  w  w  w .java 2 s. com*/
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
        @Nullable Bundle savedInstanceState) {
    //noinspection ConstantConditions
    FrameLayout layout = new FrameLayout(container.getContext());
    layout.setId(R.id.child_fragment_container);
    return layout;
}

From source file:de.uni.stuttgart.informatik.ToureNPlaner.UI.Fragments.ConstraintListFragment.java

private void setupList() {
    LinearLayout list = (LinearLayout) getView().findViewById(android.R.id.list);
    for (int i = 0; i < constraints.size(); i++) {
        FrameLayout frameLayout = new FrameLayout(getActivity());
        frameLayout.setId(i + 1);
        list.addView(frameLayout);//from w w w  . ja  v a 2  s  . c  o m
    }
}

From source file:info.ipeanut.youngsamples.supportv4.app.FragmentReceiveResultSupport.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
            ViewGroup.LayoutParams.FILL_PARENT);
    FrameLayout frame = new FrameLayout(this);
    frame.setId(R.id.simple_fragment);
    setContentView(frame, lp);//from w w  w. ja  v a2 s  .  c  om

    if (savedInstanceState == null) {
        // Do first time initialization -- add fragment.
        Fragment newFragment = new ReceiveResultFragment();
        FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
        ft.add(R.id.simple_fragment, newFragment).commit();
    }
}

From source file:com.actionbarsherlock.sample.fragments.FragmentReceiveResultSupport.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    setTheme(SampleList.THEME); //Used for theme switching in samples
    super.onCreate(savedInstanceState);
    FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
            ViewGroup.LayoutParams.FILL_PARENT);
    FrameLayout frame = new FrameLayout(this);
    frame.setId(R.id.simple_fragment);
    setContentView(frame, lp);/*from   w  ww .  j ava2s  .  com*/

    if (savedInstanceState == null) {
        // Do first time initialization -- add fragment.
        Fragment newFragment = new ReceiveResultFragment();
        FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
        ft.add(R.id.simple_fragment, newFragment).commit();
    }
}

From source file:com.actionbarsherlock.sample.demos.app.FragmentReceiveResultSupport.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT);
    FrameLayout frame = new FrameLayout(this);
    frame.setId(R.id.simple_fragment);
    setContentView(frame, lp);/*from   w w  w .  ja va 2  s.  c om*/

    if (savedInstanceState == null) {
        // Do first time initialization -- add fragment.
        Fragment newFragment = new ReceiveResultFragment();
        FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
        ft.add(R.id.simple_fragment, newFragment).commit();
    }
}