String time = starttime.getText().toString();
String[] separated = time.split(":");
test.setText("HH:" + separated[0].toString() + "MM:" + separated[1].toString());
If i type in 11:11 in my app, i get arrayoutofboundsexc开发者_如何学Pythoneption. Ive tried trim() on the string as well. Did i miss something?
No, you didn't miss something. I guess, the input misses a colon (:
). Double check the format of time
right before the split operation.
精彩评论