How can I set my enum with the value the user enter in a EditText?
问题 I have a editText where the users enter a number between 0 and 10. Depending on their entered number the enum (knowledge) will set. Here's my code so far: public int fromUserInput() { TextView eWissen = (TextView) findViewById(R.id.editText_eingabeWissentsstand); eWissen.getText().toString() == Zahl; return Zahl; } private enum Wissenstand { BEGINNER, FORTGESCHRITTENER, PRO, GRANDMASTER; static Wissenstand fromUserInput(final int input) { if (input >= 10) { return GRANDMASTER; } else if