It's a simple code, and the error message doesn't say where exactly is the deprecated usage.
package com.dev.marcellocamara.pgm.Helper;
import android.content.Context;
import android.graphics.drawable.Drawable;
import com.dev.marcellocamara.pgm.R;
public class CardHelper {
public static Drawable getBackground(Context context, int drawable){
switch (drawable){
case 1 : {
return (context.getResources().getDrawable(R.drawable.card_yellow));
}
case 2 : {
return (context.getResources().getDrawable(R.drawable.card_purple));
}
case 3 : {
return (context.getResources().getDrawable(R.drawable.card_green));
}
default : {
return null;
}
}
}
public static Drawable getFlag(Context context, int flag) {
switch (flag){
case 1 : {
return (context.getResources().getDrawable(R.drawable.flag1));
}
case 2 : {
return (context.getResources().getDrawable(R.drawable.flag2));
}
case 3 : {
return (context.getResources().getDrawable(R.drawable.flag3));
}
default : {
return null;
}
}
}
public static int getColor(Context context, int card) {
switch (card){
case 1 : {
return (context.getResources().getColor(R.color.card1));
}
case 2 : {
return (context.getResources().getColor(R.color.card2));
}
case 3 : {
return (context.getResources().getColor(R.color.card3));
}
default : {
return 0;
}
}
}
}
As code says, I'm returning the drawable or the color. It's simple. Where is the warning that need a change, and how can I skip this warning, continue returning a drawable and a color ?