Example usage for android.view LayoutInflater inflate

List of usage examples for android.view LayoutInflater inflate

Introduction

In this page you can find the example usage for android.view LayoutInflater inflate.

Prototype

public View inflate(XmlPullParser parser, @Nullable ViewGroup root, boolean attachToRoot) 

Source Link

Document

Inflate a new view hierarchy from the specified XML node.

Usage

From source file:de.fahrgemeinschaft.EditRideFragment3.java

@Override
public View onCreateView(final LayoutInflater lI, ViewGroup p, Bundle b) {
    prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
    return lI.inflate(R.layout.fragment_ride_edit3, p, false);
}

From source file:de.jadehs.jadehsnavigator.fragment.NewsFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_news, container, false);

    return rootView;
}

From source file:fr.cph.chicago.core.fragment.BusFragment.java

@Override
public final View onCreateView(final LayoutInflater inflater, final ViewGroup container,
        final Bundle savedInstanceState) {
    final View rootView = inflater.inflate(R.layout.fragment_bus, container, false);
    if (!activity.isFinishing()) {
        unbinder = ButterKnife.bind(this, rootView);
        addView();/*from   w w  w. j av a  2  s  . c o m*/
    }
    return rootView;
}

From source file:io.v.syncslides.DeckChooserFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_deck_chooser, container, false);
    FloatingActionButton fab = (FloatingActionButton) rootView.findViewById(R.id.new_deck_fab);
    fab.setOnClickListener(v -> onImportDeck());
    mRecyclerView = (RecyclerView) rootView.findViewById(R.id.deck_grid);
    // The cards for the decks are always the same size.
    mRecyclerView.setHasFixedSize(true);

    // Statically set the span count (i.e. number of columns) for now...  See below.
    mLayoutManager = new GridLayoutManager(getContext(), 2);
    mRecyclerView.setLayoutManager(mLayoutManager);
    // Dynamically set the span based on the screen width.  Cribbed from
    // http://stackoverflow.com/questions/26666143/recyclerview-gridlayoutmanager-how-to-auto-detect-span-count
    mRecyclerView.getViewTreeObserver()/*from  w  ww.ja v a  2 s.co  m*/
            .addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
                @Override
                public void onGlobalLayout() {
                    mRecyclerView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
                    int viewWidth = mRecyclerView.getMeasuredWidth();
                    float cardViewWidth = getActivity().getResources().getDimension(R.dimen.deck_card_width);
                    int newSpanCount = (int) Math.floor(viewWidth / cardViewWidth);
                    mLayoutManager.setSpanCount(newSpanCount);
                    mLayoutManager.requestLayout();
                }
            });
    mAdapter = new DeckListAdapter(DB.Singleton.get(),
            new RpcPresentationDiscovery(V23.Singleton.get().getVContext()));

    return rootView;
}

From source file:com.kanchi.periyava.Fragments.Dashboard.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    rootView = inflater.inflate(R.layout.dashboard_main, container, false);
    getActivity().setTitle(getResources().getString(R.string.app_name));
    setHasOptionsMenu(true);/*from  w w w .j  a  va 2  s.c o m*/

    new GetAsyncRadioURL("INDIA").execute(GeneralSetting.getGeneralSetting().direct_radiourl_india);

    new GetAsyncRadioURL("OTHERS").execute(GeneralSetting.getGeneralSetting().direct_radiourl_others);

    //init();
    return rootView;
}

From source file:de.elanev.studip.android.app.frontend.forums.ForumEntryComposeFragment.java

@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
        @Nullable Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.fragment_forum_area_create, container, false);
    mSubjectEditText = (EditText) v.findViewById(R.id.forum_area_subject);
    mContentEditText = (EditText) v.findViewById(R.id.forum_area_content);
    if (sEntryType == EntryType.REPLY_ENTRY) {
        mSubjectEditText.setVisibility(View.GONE);
    }/*from ww w .  ja v  a  2s .  co  m*/

    return v;
}

From source file:com.pimp.companionforband.fragments.cloud.ProfileFragment.java

@Nullable
@Override//from   w ww. j av  a  2 s  .  c  om
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
        @Nullable Bundle savedInstanceState) {
    return inflater.inflate(R.layout.fragment_profile, container, false);
}

From source file:com.thevelopment.poc.Fragments.FirstFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_first, container, false);

    screenBuilder = new ScreenBuilder(getActivity());

    renderScreen(view);/*from www  .ja  va2  s.c o m*/

    return view;
}

From source file:com.ymt.demo1.main.sign.SignUpFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.activity_sign_up, container, false);
    initView(view);/*  w w  w  .java  2  s.c o  m*/
    return view;
}

From source file:com.pureexe.calinoius.environment.camera.fragment.MainFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_main, container, false);

    dataManager = new DataManager(getActivity());

    try {//from   w  w  w .ja v  a  2  s .co m
        // Use Try catch Exception to avoid force close with CM's Privacy Guard
        Cursor c = getActivity().getApplication().getContentResolver()
                .query(ContactsContract.Profile.CONTENT_URI, null, null, null, null);
        c.moveToFirst();
        dataManager.setString("Researcher", c.getString(c.getColumnIndex("display_name")));
    } catch (Exception e) {
        dataManager.setString("Researcher", "Unknown");
    }
    GridView gridview = (GridView) rootView.findViewById(R.id.gridView1);
    gridview.setAdapter(new HomePageAdapter(getActivity()));
    gridview.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
            if (position == 0) {
                Intent beepActivity = new Intent(getActivity(), FragmentDisplayActivity.class);
                beepActivity.setAction(Intent.ACTION_SEND);
                beepActivity.putExtra(Intent.EXTRA_TEXT, "UserFragment");
                beepActivity.setType("beepActivity");
                startActivity(beepActivity);
            }
            if (position == 1) {
                Intent intent = new Intent(getActivity(), EnvironmentCameraActivity.class);
                startActivity(intent);
            }
            if (position == 2) {
                Intent beepActivity = new Intent(getActivity(), FragmentDisplayActivity.class);
                beepActivity.setAction(Intent.ACTION_SEND);
                beepActivity.putExtra(Intent.EXTRA_TEXT, "EXIFreadFragment");
                beepActivity.setType("beepActivity");
                startActivity(beepActivity);
            }
            if (position == 3) {
                Intent beepActivity = new Intent(getActivity(), FragmentDisplayActivity.class);
                beepActivity.setAction(Intent.ACTION_SEND);
                beepActivity.putExtra(Intent.EXTRA_TEXT, "SettingPreferenceFragment");
                beepActivity.setType("beepActivity");
                startActivity(beepActivity);
            }
            if (position == 4) {
                Intent beepActivity = new Intent(getActivity(), FragmentDisplayActivity.class);
                beepActivity.setAction(Intent.ACTION_SEND);
                beepActivity.putExtra(Intent.EXTRA_TEXT, "HelpFragment");
                beepActivity.setType("beepActivity");
                startActivity(beepActivity);
            }
            if (position == 5) {
                Intent beepActivity = new Intent(getActivity(), FragmentDisplayActivity.class);
                beepActivity.setAction(Intent.ACTION_SEND);
                beepActivity.putExtra(Intent.EXTRA_TEXT, "AboutFragment");
                beepActivity.setType("beepActivity");
                startActivity(beepActivity);
            }
        }
    });

    return rootView;
}