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.streaming.sweetplayer.fragment.SearchFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (container == null) {
        return null;
    }//from   w  w w  .j  av a2s.  c om

    View view = inflater.inflate(R.layout.songs_list, container, false);
    mActivity = this.getActivity();
    return view;
}

From source file:cc.softwarefactory.lokki.android.fragments.AddContactsFragment.java

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

    View rootView = inflater.inflate(R.layout.activity_add_contacts, container, false);
    aq = new AQuery(getActivity(), rootView);
    cancelAsynTasks = false;/*from  ww  w  . ja  va 2 s  .  c  o  m*/
    context = getActivity().getApplicationContext();
    avatarLoader = new AvatarLoader(context);
    inputSearch = (EditText) rootView.findViewById(R.id.add_contact_search);
    clearFilter = (Button) rootView.findViewById(R.id.clear_filter);

    return rootView;
}

From source file:net.reichholf.dreamdroid.fragment.TimerListFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.card_list_content_fab, container, false);
    AbsListView listView = (AbsListView) view.findViewById(android.R.id.list);
    registerFab(R.id.fab_add, view, new View.OnClickListener() {
        @Override/*from   w  w w.  ja  v a  2s  .c om*/
        public void onClick(View v) {
            onItemSelected(Statics.ITEM_NEW_TIMER);
        }
    }, listView);
    return view;
}

From source file:com.grass.caishi.cc.activity.main.SettingsFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    return inflater.inflate(R.layout.fragment_conversation_setting, container, false);
}

From source file:io.v.android.apps.syncslides.NavigationDrawerFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mDrawerListView = (ListView) inflater.inflate(R.layout.fragment_navigation_drawer, container, false);
    mDrawerListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override//from  ww  w .j  a  v  a2 s . com
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            selectItem(position);
        }
    });
    mDrawerListView.setAdapter(new ArrayAdapter<String>(getActionBar().getThemedContext(),
            android.R.layout.simple_list_item_activated_2, android.R.id.text1, new String[] { mUserName }) {
        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            View view = super.getView(position, convertView, parent);
            ((TextView) view.findViewById(android.R.id.text1)).setText(mUserName);
            ((TextView) view.findViewById(android.R.id.text2)).setText(mUserEmail);
            return view;
        }
    });
    mDrawerListView.setItemChecked(mCurrentSelectedPosition, true);
    return mDrawerListView;
}

From source file:com.digitalbuana.smiles.ui.ContactAdd.java

@Override
protected void onInflate(Bundle savedInstanceState) {
    setContentView(R.layout.contact_add);

    ListView listView = getListView();
    LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
    View view = inflater.inflate(R.layout.contact_add_header, listView, false);
    listView.addHeaderView(view, null, false);

    //      accountView = (Spinner) view.findViewById(R.id.contact_account);
    //      accountView.setAdapter(new AccountChooseAdapter(this));
    //      accountView.setOnItemSelectedListener(this);
    userView = (EditText) view.findViewById(R.id.contact_user);
    nameView = (EditText) view.findViewById(R.id.contact_name);
    ((Button) view.findViewById(R.id.ok)).setOnClickListener(this);

    String name;//from w w w  . jav  a  2s  .c o m
    Intent intent = getIntent();
    if (savedInstanceState != null) {
        account = savedInstanceState.getString(SAVED_ACCOUNT);
        user = savedInstanceState.getString(SAVED_USER);
        name = savedInstanceState.getString(SAVED_NAME);
    } else {
        account = getAccount(intent);
        user = getUser(intent);
        if (account == null || user == null)
            name = null;
        else {
            name = RosterManager.getInstance().getName(account, user);
            if (user.equals(name))
                name = null;
        }
    }
    if (account == null) {
        Collection<String> accounts = AccountManager.getInstance().getAccounts();
        if (accounts.size() == 1)
            account = accounts.iterator().next();
    }
    //      if (account != null) {
    //         for (int position = 0; position < accountView.getCount(); position++)
    //            if (account.equals(accountView.getItemAtPosition(position))) {
    //               accountView.setSelection(position);
    //               break;
    //            }
    //      }
    if (user != null)
        userView.setText(StringUtils.replaceStringEquals(user));
    if (name != null)
        nameView.setText(name);
    if (ACTION_SUBSCRIPTION_REQUEST.equals(intent.getAction())) {
        subscriptionRequest = PresenceManager.getInstance().getSubscriptionRequest(account, user);
        if (subscriptionRequest == null) {
            Application.getInstance().onError(R.string.ENTRY_IS_NOT_FOUND);
            finish();
            return;
        }
    } else {
        subscriptionRequest = null;
    }
}

From source file:com.example.android.popularmovies.app.MoviesFragment.java

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

    movieAdapter = new MovieAdapter(getActivity(), movieArray);

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

    GridView gridView = (GridView) rootView.findViewById(R.id.gridview_movie);
    gridView.setAdapter(movieAdapter);//from   w w w .  ja  v  a2  s .  com

    // gridView.setColumnWidth(Integer.parseInt(getString(R.string.tmdb_image_size_342)));

    gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) {
            Movie movie = movieAdapter.getItem(position);
            Intent intent = new Intent(getActivity(), DetailsActivity.class);
            intent.putExtra("movie", movie);
            startActivity(intent);
        }
    });

    return rootView;
}

From source file:com.hybris.mobile.adapter.BasketAdapter.java

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    CartItem cartItem = items.get(position);
    View rowView = null;/*from   ww  w .  j  a  v  a2  s. c  om*/

    if (cartItem instanceof CartEntry) {
        CartEntry cartEntry = (CartEntry) cartItem;

        rowView = inflater.inflate(R.layout.cart_row, parent, false);

        TextView lblProductTitle = (TextView) rowView.findViewById(R.id.lbl_product_title);
        TextView lblProductPrice = (TextView) rowView.findViewById(R.id.lbl_price_quantity);
        TextView lblManufacturer = (TextView) rowView.findViewById(R.id.lbl_productManufacturer);
        TextView lblTotal = (TextView) rowView.findViewById(R.id.lbl_total);
        ImageView productImage = (ImageView) rowView.findViewById(R.id.img_product);

        if (StringUtils.isEmpty(cartEntry.getProduct().getManufacturer())) {
            lblManufacturer.setHeight(0);
        } else {
            lblManufacturer.setText(cartEntry.getProduct().getManufacturer());
        }
        lblProductTitle.setText(cartEntry.getProduct().getName());
        lblProductPrice.setText(cartEntry.getBasePrice().getFormattedValue() + " - "
                + this.getContext().getString(R.string.cartentry_quantity_placeholder)
                + cartEntry.getQuantity().toString());
        lblManufacturer.setText(cartEntry.getProduct().getManufacturer());

        lblTotal.setText(cartEntry.getTotalPrice().getFormattedValue());
        UrlImageViewHelper.setUrlDrawable(productImage, cartEntry.getProduct().getThumbnail(),
                R.drawable.loading_drawable);
    }

    return rowView;
}

From source file:com.p2c.thelife.SettingsFragment.java

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

From source file:com.polatic.pantaudki.home.HomeFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mSharedPreferences = getActivity().getSharedPreferences(Constant.PREFERENCES_NAME, Context.MODE_PRIVATE);
    View rootView = inflater.inflate(R.layout.home_fragment_parent, container, false);

    final ActionBar actionBar = ((ActionBarActivity) getActivity()).getSupportActionBar();

    // Set drawer menu title
    int i = getArguments().getInt(Constant.FRAGMENT_NUMBER);
    String menu_title = getResources().getStringArray(R.array.sidebar_menu_array)[i];
    getActivity().setTitle(menu_title);//from  www .j a  va 2 s . c  om

    // Show back arrow in action bar - MUST
    ((ActionBarActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    ((ActionBarActivity) getActivity()).getSupportActionBar().setTitle(menu_title);

    initView(rootView);
    return rootView;
}