Skip to content Skip to sidebar Skip to footer

Click On Textview On Listview On Fragment

click on textview on listview on fragment TextView On category_row.xml textViewCategoryName onclick SetText this textViewCategoryName ok! CategoriesFragment.java package com.examp

Solution 1:

You have to set an onClickListener to your TextView in your ViewHolder.

private static class ViewHolder {
    public final RelativeLayout rootView;
    public final TextView textViewCategoryName;

    private ViewHolder(RelativeLayout rootView, TextView textViewCategoryName) {
        this.rootView = rootView;
        this.textViewCategoryName = textViewCategoryName;
    }

    public static ViewHolder create(RelativeLayout rootView) {
        TextView textViewCategoryName = (TextView) rootView.findViewById(R.id.textViewCategoryName);
        textViewCategoryName.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                // Do whatever you want
            }
        });
        return new ViewHolder(rootView, textViewCategoryName);
    }
}

Post a Comment for "Click On Textview On Listview On Fragment"