0

I've seen all questions that already post here...

ExpandableListView getChildAt() return null

Android GridView getChildAt(0).findViewById() returns null

But my problem not solve so please help me.

I just want to show textview background color in GroupView that expand and change previous one.

View view = expListView.getChildAt(id);

Its give me view everytime

textView = (TextView) view.findViewById(R.id.tv_basket_name);

But findViewById() gives null sometimes

    View view = expListView.getChildAt(id);
    if (view != null) {
        textView = (TextView) view.findViewById(R.id.tv_basket_name);
        if (textView != null) //Sometime gives null
            textView.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.gray));
    }
sajjad
  • 21
  • 3

0 Answers0