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:com.meetingninja.csse.user.ProfileFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    pageView = inflater.inflate(R.layout.fragment_profile, container, false);
    setupViews(pageView);/*from www .j a va  2 s.c  o m*/
    session = SessionManager.getInstance();

    Bundle extras = getArguments();
    displayedUser = new User();

    if (extras != null && extras.containsKey(Keys.User.PARCEL)) {

        displayedUser = ((UserParcel) extras.getParcelable(Keys.User.PARCEL)).getUser();
        try {
            System.out.println(JsonUtils.getObjectMapper().writeValueAsString(displayedUser));
        } catch (JsonProcessingException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    } else {
        Log.v(TAG, "Displaying Current User");
        displayedUser.setID(session.getUserID());
    }
    if (extras != null && extras.containsKey("notMine")) {
        menu = R.menu.menu_profile;
    } else {
        menu = R.menu.menu_view_profile;
    }
    setHasOptionsMenu(true);
    fetchUserInfo(displayedUser.getID());

    return pageView;

}

From source file:com.example.cuisoap.agrimac.machineRegister.machineInfoFragment.java

public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_machineinfo, container, false);
    machine_name = (EditText) view.findViewById(R.id.machine_name);
    passenger_num = (EditText) view.findViewById(R.id.machine_maxpassenger);
    power = (EditText) view.findViewById(R.id.machine_power);
    wheel_distance = (EditText) view.findViewById(R.id.machine_wheeldistance);
    check_time = (EditText) view.findViewById(R.id.machine_checktime);
    license1 = (Button) view.findViewById(R.id.machine_licence_button1);
    license_pic1 = (ImageView) view.findViewById(R.id.machine_licence_pic1);
    license2 = (Button) view.findViewById(R.id.machine_licence_button2);
    license_pic2 = (ImageView) view.findViewById(R.id.machine_licence_pic2);
    machine_type = (TextView) view.findViewById(R.id.machine_type);
    pay_type = (RadioGroup) view.findViewById(R.id.machine_paytype);
    power_type = (RadioGroup) view.findViewById(R.id.machine_powertype);
    confrim = (Button) view.findViewById(R.id.machine_confirm);

    license1.setOnClickListener(myOnClickListener);
    license2.setOnClickListener(myOnClickListener);
    confrim.setOnClickListener(myOnClickListener);
    machine_type.setOnClickListener(myOnClickListener);
    return view;//w ww.j  a  v  a  2  s . c o m
}

From source file:com.actionbarsherlock.internal.view.menu.ListMenuItemView.java

private void insertCheckBox() {
    LayoutInflater inflater = getInflater();
    mCheckBox = (CheckBox) inflater.inflate(R.layout.abs__list_menu_item_checkbox, this, false);
    addView(mCheckBox);/*from w  w  w .j a v  a 2s  . c  o  m*/
}

From source file:com.example.administrator.myapplication2._2_exercise._2_End.RightFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View rootView = inflater.inflate(R.layout._2_fragment_map, container, false);

    Intent myIntent = getActivity().getIntent();
    if (myIntent != null) {
        seq = myIntent.getStringExtra("seq");
    }//from   w  ww .j a v a2s.c  o  m

    SharedPreferences myPrefs = this.getActivity().getSharedPreferences("login", Context.MODE_PRIVATE);
    if ((myPrefs != null) && (myPrefs.contains("id"))) {
        id = myPrefs.getString("id", "");
    }

    // ? ? 
    map = ((SupportMapFragment) getChildFragmentManager().findFragmentById(R.id.map2)).getMap();

    map.setMyLocationEnabled(true);

    arrayPoints = new ArrayList<LatLng>();

    // getRecentSeq();
    getRecentData();

    return rootView;
}

From source file:com.actionbarsherlock.internal.view.menu.ListMenuItemView.java

private void insertIconView() {
    LayoutInflater inflater = getInflater();
    mIconView = (ImageView) inflater.inflate(R.layout.abs__list_menu_item_icon, this, false);
    addView(mIconView, 0);/*from w  w w .ja v  a  2  s  .  c  om*/
}

From source file:com.facebook.samples.socialcafe.MenuFragmentActivity.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.main_menu, parent, false);
    getActivity().setTitle(R.string.menu);

    userNameView = (TextView) v.findViewById(R.id.user_name);
    userPicView = (ImageView) v.findViewById(R.id.user_pic);
    if (userName != null) {
        userNameView.setText(userName);/*from   www  .j  a v a  2s.co  m*/
    }
    if (userPic != null) {
        userPicView.setImageBitmap(userPic);
    }
    ListView drinkList = (ListView) v.findViewById(R.id.menu_list);
    drinkList.setAdapter(new DrinkListAdapter());

    drinkList.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> arg0, View arg1, int position, long id) {
            Drink drink = (Drink) arg0.getItemAtPosition(position);
            Intent orderIntent = new Intent(getActivity(), OrderDrinkActivity.class);
            orderIntent.putExtra("DRINK_URL", drink.getURL());
            startActivity(orderIntent);
        }

    });

    return v;
}

From source file:com.example.run_tracker.MyRunsFragment.java

public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    Log.v(TAG, "onCreateView");

    View rootView = inflater.inflate(R.layout.myrunfragment, container, false);

    listView = (ListView) rootView.findViewById(R.id.list);
    mRefresh = (Button) rootView.findViewById(R.id.refresh);
    listView.setOnItemClickListener(this);
    mMapFragment = CustomMapFragment.newInstance();
    getChildFragmentManager().beginTransaction().replace(R.id.map_container, mMapFragment).commit();
    mRefresh.setOnClickListener(this);
    return rootView;

}

From source file:com.actionbarsherlock.internal.view.menu.ListMenuItemView.java

private void insertRadioButton() {
    LayoutInflater inflater = getInflater();
    mRadioButton = (RadioButton) inflater.inflate(R.layout.abs__list_menu_item_radio, this, false);
    addView(mRadioButton);/*from w  w w .  j a  v a 2s  .  c  o  m*/
}

From source file:com.wenwen.chatuidemo.activity.PersonFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    DebugLog.i(TAG, "onCreateView");
    return inflater.inflate(R.layout.fragment_tab_person, container, false);
}

From source file:org.mifos.androidclient.util.listadapters.SimpleExpandableListAdapter.java

@Override
public View getChildView(int groupPos, int childPos, boolean isLastChild, View convertView, ViewGroup parent) {
    View row;/*from   w w w .  ja  v  a2  s . co  m*/
    if (convertView == null) {
        LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        row = inflater.inflate(R.layout.simple_list_child, parent, false);
    } else {
        row = convertView;
    }
    SimpleListItem item = (SimpleListItem) getChild(groupPos, childPos);
    if (item != null) {
        TextView label = (TextView) row.findViewById(R.id.simple_list_item_label);
        label.setText(item.getListLabel());
    }
    return row;
}