我遇到了异常IllegalStateException
:
已作为父项添加到经理的字段
当我第二次调用下面的函数时,当我改变微调器的值并且第二次调用这个函数时,我得到了非法状态异常。
这是我的代码:
void showSpinnerDialog(int type) {
if (_customSpinnerPopup == null) {
_customSpinnerPopup = new CustomSpinnerPopup();
}
UiApplication.getUiApplication().pushModalScreen(_customSpinnerPopup);
if (_customSpinnerPopup.isSet()) {
String choice = _customSpinnerPopup.getChoice();
_editFieldSpinbox.setText(choice);
getAlbumsForLanguage(choice);
}
}
private void getAlbumsForLanguage(String choice) {
language = choice;
fieldManager.deleteAll();
final RichList list = new RichList(fieldManager, true, 2, 1);
songItemsList = new Vector();
songItemsList = ServerAPI.getNewSongsForLanguage(language, null);
for (int i = 0; i < songItemsList.size(); i++) {
SongItem songItem = (SongItem) songItemsList.elementAt(i);
list.add(new Object[] { bitmap1, songItem.getName(),
"Artist:" + songItem.getArtist(),
"Movie: " + songItem.getMovie() });
}
add(fieldManager);// **here i am getting exception**
list.setFocusPolicy(TableController.ROW_FOCUS);
list.setCommand(new Command(new CommandHandler() {
public void execute(ReadOnlyCommandMetadata metadata, Object object) {
SongItem song = (SongItem) songItemsList.elementAt(list.getFocusRow());
Dialog.alert("exe !" + song.getName());