Example usage for android.view ViewGroup getContext

List of usage examples for android.view ViewGroup getContext

Introduction

In this page you can find the example usage for android.view ViewGroup getContext.

Prototype

@ViewDebug.CapturedViewProperty
public final Context getContext() 

Source Link

Document

Returns the context the view is running in, through which it can access the current theme, resources, etc.

Usage

From source file:com.simplechatclient.android.ProfileListFragment.java

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

    myStart();//from   ww w  . j a v  a  2  s  .  c  o m

    return view;
}

From source file:cn.zhangls.android.weibo.ui.details.comment.CommentRecyclerAdapter.java

@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    ItemCommentListBinding commentListBinding = DataBindingUtil
            .inflate(LayoutInflater.from(parent.getContext()), R.layout.item_comment_list, parent, false);
    ViewHolder holder = new ViewHolder(commentListBinding.getRoot());
    holder.setBinding(commentListBinding);

    return holder;
}

From source file:com.jaredrummler.android.colorpicker.ColorPaletteAdapter.java

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    final ViewHolder holder;
    if (convertView == null) {
        holder = new ViewHolder(parent.getContext());
        convertView = holder.view;//from ww  w.j a v  a 2s .  c o  m
    } else {
        holder = (ViewHolder) convertView.getTag();
    }
    holder.setup(position);
    return convertView;
}

From source file:com.hanks.zhe800.ui.adapter.JinriListAdapter.java

private View xmlToView(ViewGroup parent, int layoutId) {
    LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext());
    return layoutInflater.inflate(layoutId, parent, false);
}

From source file:com.zmf.editablelist.EditListAdapter.java

@Override
public ItemViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.activity_edit_item, parent, false);
    ItemViewHolder itemViewHolder = new ItemViewHolder(view);
    return itemViewHolder;
}

From source file:com.netthreads.traffic.view.TrafficDataDetailsFragment.java

/**
 * Create details view.// w ww  . ja v  a 2 s. c  o  m
 *
 * @param inflater
 * @param container
 * @param savedInstanceState
 * @return Return view.
 */
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_item_details, container, false);

    Context context = container.getContext();

    Bundle bundle = getArguments();

    String categoryClass = bundle.getString(ARG_CATEGORY_CLASS);
    String category = bundle.getString(ARG_CATEGORY);
    String severity = bundle.getString(ARG_SEVERITY);
    String location = bundle.getString(ARG_LOCATION);
    String description = bundle.getString(ARG_DESCRIPTION);

    // Set view elements from supplied data.
    String name = TrafficDataHelper.buildIconName(categoryClass, severity);

    Bitmap icon = ImageHelper.fetchIcon(context, name, TrafficRecord.DEFAULT_ICON);

    image = (ImageView) rootView.findViewById(R.id.event_image);
    locationText = (TextView) rootView.findViewById(R.id.event_location);
    descriptionText = (TextView) rootView.findViewById(R.id.event_description);
    categoryText = (TextView) rootView.findViewById(R.id.event_category);

    image.setImageBitmap(icon);
    locationText.setText(location);
    descriptionText.setText(description);
    categoryText.setText(category);

    return rootView;
}

From source file:com.example.simon.material.SubjectList.MyExpandableItemAdapter.java

@Override
public MyGroupViewHolder onCreateGroupViewHolder(ViewGroup parent, int viewType) {
    final LayoutInflater inflater = LayoutInflater.from(parent.getContext());
    final View v = inflater.inflate(R.layout.frayment_recyclerview_groupitems, parent, false);
    return new MyGroupViewHolder(v);
}

From source file:com.example.simon.material.SubjectList.MyExpandableItemAdapter.java

@Override
public MyChildViewHolder onCreateChildViewHolder(ViewGroup parent, int viewType) {
    final LayoutInflater inflater = LayoutInflater.from(parent.getContext());
    final View v = inflater.inflate(R.layout.fragment_recyclerview_subitem, parent, false);
    return new MyChildViewHolder(v);
}

From source file:com.h6ah4i.android.example.advrecyclerview.demo_e.MyExpandableItemAdapter.java

@Override
public MyGroupViewHolder onCreateGroupViewHolder(ViewGroup parent, int viewType) {
    final LayoutInflater inflater = LayoutInflater.from(parent.getContext());
    final View v = inflater.inflate(R.layout.list_group_item, parent, false);
    return new MyGroupViewHolder(v);
}

From source file:com.h6ah4i.android.example.advrecyclerview.demo_e.MyExpandableItemAdapter.java

@Override
public MyChildViewHolder onCreateChildViewHolder(ViewGroup parent, int viewType) {
    final LayoutInflater inflater = LayoutInflater.from(parent.getContext());
    final View v = inflater.inflate(R.layout.list_item, parent, false);
    return new MyChildViewHolder(v);
}