Java tutorial
//package com.java2s; import java.util.ArrayList; import java.util.StringTokenizer; public class Main { public static ArrayList<String> splitInputStringIntoWords(String msg) { StringTokenizer token = new StringTokenizer(msg, " "); ArrayList<String> wordsList = new ArrayList<String>(); String nextWord; while (token.hasMoreTokens()) { nextWord = token.nextToken(); // Log.d(TAG, " inside getWords while loop.. nextToken - " + // nextWord); wordsList.add(nextWord); } return wordsList; } }