android - Got hit by an UnsupportedOperationException -


i have following code:

    private static arrayadapter<string> adapter;     private static list<chapter> chapters;      public void update(book book) {         adapter.clear();         if (chapters != null) {             chapters.clear();         }         chapters = databaseconnector.getchaptersfrombook(book.getid());         (chapter chapter : chapters) {             adapter.add(chapter.gettitle());         }         header.settext(book.getabbreviation());         subheader.settext(book.getname() + " (" + book.getnumber() + ")");         subheader.setvisibility(view.visible);     } 

if call method update(book book) , variable chapters not null, hit unsupportedoperationexception in line chapters.clear(). hints how solve problem?

i have @ api documentation, presumably databaseconnector.getchaptersfrombook(book.getid()) call returning immutable list, can't modify it. seems have make local copy.


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -