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.google.cast.samples.games.codelab.LobbyFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment.
    View view = inflater.inflate(R.layout.lobby_fragment, container, false);

    mNameEditText = (EditText) view.findViewById(R.id.name);
    mSpinner = (ProgressBar) view.findViewById(R.id.spinner);
    mJoinStartButton = (Button) view.findViewById(R.id.button_join_start);
    mJoinStartButton.setOnClickListener(new View.OnClickListener() {
        @Override//from  w ww.  j a va  2s.  co  m
        public void onClick(View v) {
            onJoinStartClicked();
        }
    });
    return view;
}

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

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

From source file:cn.newgxu.android.bbs.ui.ForumFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.forum, container, false);
    about = (TextView) v.findViewById(R.id.about);
    masters = (TextView) v.findViewById(R.id.masters);
    listView = (ListView) v.findViewById(android.R.id.list);
    return v;/*from   w  w  w . j a  v a  2  s  . c o  m*/
}

From source file:com.sawyer.advadapters.app.adapters.jsonadapter.UnitTestMovieAdapter.java

@Override
public View getView(LayoutInflater inflater, int position, View convertView, ViewGroup parent) {
    UnitTestViewHolder vh;/*from  www .jav  a  2s  .  co m*/
    if (convertView == null) {
        convertView = inflater.inflate(android.R.layout.two_line_list_item, parent, false);
        vh = new UnitTestViewHolder(convertView);
        convertView.setTag(vh);
    } else {
        vh = (UnitTestViewHolder) convertView.getTag();
    }

    Object item = getItem(position);
    vh.title.setText(item.getClass().getSimpleName());
    vh.subtitle.setText(item.toString());

    return convertView;
}

From source file:com.sawyer.advadapters.app.adapters.jsonadapter.MovieJSONAdapter.java

@Override
public View getView(LayoutInflater inflater, int position, View convertView, ViewGroup parent) {
    MovieViewHolder vh;//w w w.  j a v a2 s  .  com
    if (convertView == null) {
        convertView = inflater.inflate(R.layout.item_movie1, parent, false);
        vh = new MovieViewHolder(convertView);
        convertView.setTag(vh);
    } else {
        vh = (MovieViewHolder) convertView.getTag();
    }

    try {
        JSONObject movie = optItemJSONObject(position);
        vh.title.setText(movie.getString(MovieItem.JSON_TITLE));
        vh.subtitle.setText(movie.getString(MovieItem.JSON_YEAR));
        vh.icon.setImageResource((movie.getBoolean(MovieItem.JSON_IS_RECOMMENDED)) ? R.drawable.ic_rating_good
                : R.drawable.ic_rating_bad);
    } catch (JSONException e) {
        Log.e(MovieJSONAdapter.class.getSimpleName(), "GetView error", e);
    }

    return convertView;
}

From source file:com.autoparts.buyers.action_content.fragment.ModelFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final View v = inflater.inflate(R.layout.about, container, false);
    initView(v);/*from ww w.  j  a v  a2 s. c  o m*/
    return v;
}

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

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

    Intent myIntent = getActivity().getIntent();
    if (myIntent != null) {
        seq = myIntent.getStringExtra("seq");
    }/*w  w w.j  a  va 2 s. c o  m*/

    tvHeart = (TextView) rootView.findViewById(R.id.tvHeart);
    tvDistance = (TextView) rootView.findViewById(R.id.tvDistance);
    tvCalorie = (TextView) rootView.findViewById(R.id.tvCalorie);
    tvWeight = (TextView) rootView.findViewById(R.id.tvWeight);
    tvRuntime = (TextView) rootView.findViewById(R.id.tvRuntime);

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

    // getRecentSeq();
    getRecentData();

    return rootView;
}

From source file:com.seregil13.literarytracker.lightnovel.LightNovelDetailFragment.java

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

    mAuthorTextView = (TextView) view.findViewById(R.id.author);
    mCompletedTextView = (TextView) view.findViewById(R.id.completionStatus);
    mDescriptionTextView = (TextView) view.findViewById(R.id.description);
    mTranslatorSiteTextView = (TextView) view.findViewById(R.id.translatorSite);
    mGenresLayout = (WrappedLinearLayout) view.findViewById(R.id.genres);

    return view;//  ww w.  j  a v  a  2 s.c  o m
}

From source file:com.linkedin.android.eventsapp.AttendeeAdapter.java

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View rowView = inflater.inflate(R.layout.attendee_list_item, parent, false);
    TextView attendeeNameView = (TextView) rowView.findViewById(R.id.attendeeName);
    final TextView attendeeHeadlineView = (TextView) rowView.findViewById(R.id.attendeeHeadline);
    final ImageView attendeeImageView = (ImageView) rowView.findViewById(R.id.attendeeImage);

    Person attendee = attendees[position];
    attendeeNameView.setText(attendee.getFirstName() + " " + attendee.getLastName());

    boolean isAccessTokenValid = LISessionManager.getInstance(context).getSession().isValid();
    if (isAccessTokenValid) {
        String url = Constants.personByIdBaseUrl + attendee.getLinkedinId() + Constants.personProjection;
        //LISession liSession = LISessionManager.getInstance(context).getSession()
        APIHelper.getInstance(context).getRequest(context, url, new ApiListener() {
            @Override/*from  ww  w. j a va2s .c  o m*/
            public void onApiSuccess(ApiResponse apiResponse) {
                try {
                    JSONObject dataAsJson = apiResponse.getResponseDataAsJson();
                    String headline = dataAsJson.has("headline") ? dataAsJson.getString("headline") : "";
                    String pictureUrl = dataAsJson.has("pictureUrl") ? dataAsJson.getString("pictureUrl")
                            : null;
                    JSONObject location = dataAsJson.getJSONObject("location");

                    attendeeHeadlineView.setText(headline);
                    if (pictureUrl != null) {
                        new com.linkedin.android.eventsapp.FetchImageTask(attendeeImageView)
                                .execute(pictureUrl);
                    } else {
                        attendeeImageView.setImageResource(R.drawable.ghost_person);
                    }
                } catch (JSONException e) {

                }

            }

            @Override
            public void onApiError(LIApiError apiError) {

            }
        });
    } else {
        attendeeImageView.setImageResource(R.drawable.ghost_person);
    }

    return rowView;
}

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

@Nullable
@Override/*w  w w  .ja  v a  2 s  . c  om*/
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
        @Nullable Bundle savedInstanceState) {
    return inflater.inflate(R.layout.fragment_activities, container, false);
}