• Post Reply Bookmark Topic Watch Topic
  • New Topic

trying to add items dynamically to spinner with alertdialog

 
Patrick Martz
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i get the following error when i try to add an item from an EditText input inside an alert dialog to a spinner through an adapter, actual code below.

error: Fatal Exception: main
java.lang.UnsupportedOperationException
at java.util.AbstractList.add(AbstractList.java:411)
at java.util.AbstractList.add(AbstractList.java:432)
at android.widget.ArrayAdapter.add(ArrayAdapter.java:178)
*at remoteGraphics.oac.Place_RemoteActivity$1.onClick(Place_RemoteActivity.java:121)

declarations:


*line in code



 
Hardik Trivedi
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not sure about that UnsupportedException.
But you can call notify datasetChanged method for that adapter. This method will work as refresh kind of thing.
 
Patrick Martz
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i used this instead and it works fine for me.







 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!