How can I split each of the sentence in the arraylist? what i'm trying to make is, a different set of sentence to be splitted and shuffle, and student will arrange it in correct order
public class QuestionActivity1 extends AppCompatActivity { private int presCounter = 0; private int maxpresCounter; private List<QuestionModel1> list; TextView textScreen, textQuestion, textTitle; Button submitBtn; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_question1); Toolbar toolbar=findViewById(R.id.toolbar); setSupportActionBar(toolbar); submitBtn=(Button) findViewById(R.id.submitBtn); list=new ArrayList<>(); list.add(new QuestionModel1("The kids are playing")); list.add(new QuestionModel1("The kids are sleeping")); list.add(new QuestionModel1("The kids are dancing")); keys=shuffleArray(keys); for (String key : keys){ addView(((LinearLayout) findViewById(R.id.layoutParent)), key, ((EditText) findViewById(R.id.editText))); } maxpresCounter= keys.length; } I can only try one
private String sentence="The kids are playing"; private String[] keys=sentence.split(" "); QuestionModel Class
public class QuestionModel1 { private String sentence; public QuestionModel1(String sentence) { this.sentence = sentence; } public String getSentence() { return sentence; } public void setSentence(String sentence) { this.sentence = sentence; } }