ResourcesCompat constructor has private acess

Viewed 393

error is very clear but the google android docs says the constructor is public.

I've used below code in my app

import android.support.v4.content.res.ResourcesCompat;

final ResourcesCompat resourcesCompat = new ResourcesCompat();
    final int foreground = resourcesCompat.getColor(getResources(), night ? R.color.night_status_bar_text : R.color.status_bar_text, getTheme());
    final int background = resourcesCompat.getColor(getResources(), night ? R.color.night_game_background : R.color.game_background, getTheme());
    statusBar.setTextColor(foreground);

I've added android-v4 support library latest one (support-v4 24.0.0). Android studio is giving 'ResourcesCompat constructor has private access' but google docs says that constructor is public.

Please help me to get solve this.

1 Answers
Related