sharedPreferences.getString("lang_pref", "English(en)")видно, что хранится не индекс, а значение
public class MainActivity extends AppCompatActivity {
MyDraw draw;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
draw = new MyDraw(this);
setContentView(draw);
Timer timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
draw.incI();
draw.invalidate();
}
}, 500, 500);
}
class MyDraw extends View {
private int i = 0;
public MyDraw(Context context) {
super(context);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
canvas.drawColor(Color.BLACK);
Paint paint = new Paint();
paint.setColor(Color.WHITE);
canvas.drawRect(new Rect(i, i, i + 50, i + 50), paint);
}
public void incI() {
i += 10;
if (i > 1500)
i = 0;
}
}
}