I did the API check yet its showing deprecation warning while compiling.
private void tab_sel(boolean whi_one){
View vie1 = findViewById(R.id.tab_sel1);
View vie2 = findViewById(R.id.tab_sel2);
int whi, gra, pos, neg;
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
whi = getResources().getColor(R.color.white);
gra = getResources().getColor(R.color.tabInactive);
} else {
whi = getColor(R.color.white);
gra = getColor(R.color.tabInactive);
}
if(whi_one){
vie1.setVisibility(View.VISIBLE);
vie2.setVisibility(View.INVISIBLE);
pos = whi;
neg = gra;
} else {
vie1.setVisibility(View.INVISIBLE);
vie2.setVisibility(View.VISIBLE);
pos = gra;
neg = whi;
}
tv_pos_tit.setTextColor(pos);
tv_pos_bal.setTextColor(pos);
tv_neg_tit.setTextColor(neg);
tv_neg_bal.setTextColor(neg);
}
Can anybody tell me while it shows deprecation warning? it shows
whi = getResources().getColor(R.color.white) and
gra = getResources().getColor(R.color.tabInactive)
as deprecated lines