I'm a newbie to the android development. I have two approaches to change the layout background color via Java. Which one could be more appropriate and why?
The first approach is:
LinearLayout layout = (LinearLayout) convertView.findViewById(R.id.translation_container);
layout.setBackgroundColor(mColor);
and the second one:
View view = convertView.findViewById(R.id.translation_container);
int color = ContextCompat.getColor(getContext(),mColor);
view.setBackgroundColor(color);