 <p>If you are creating a class that extends an Adapter, you can use parent variable to obtain the context.</p> <pre><code>public class MyAdapter extends ArrayAdapter&lt;String&gt; { private Context context; @Override public View getView(int position, View convertView, ViewGroup parent) { context = parent.getContext(); context.getResources().getColor(R.color.red); return convertView; } } </code></pre> <p>You can do the same with RecyclerView.Adapter, but instead of getview() you will use onCreateViewHolder().</p>