簡単な質問があります。アクティビティを再起動せずに ListView からアイテムを削除したい。これは可能ですか?
私が試した:
adapter.remove(adapter.getItem(currentPosition)); // line 188
しかし、次のエラーが発生します。
11-22 17:59:36.520: E/AndroidRuntime(8124): FATAL EXCEPTION: main
11-22 17:59:36.520: E/AndroidRuntime(8124): java.lang.UnsupportedOperationException
11-22 17:59:36.520: E/AndroidRuntime(8124): at java.util.AbstractList.remove(AbstractList.java:645)
11-22 17:59:36.520: E/AndroidRuntime(8124): at java.util.AbstractList$SimpleListIterator.remove(AbstractList.java:77)
11-22 17:59:36.520: E/AndroidRuntime(8124): at java.util.AbstractCollection.remove(AbstractCollection.java:230)
11-22 17:59:36.520: E/AndroidRuntime(8124): at android.widget.ArrayAdapter.remove(ArrayAdapter.java:248)
11-22 17:59:36.520: E/AndroidRuntime(8124): at host.activity.ACT_MessaggiRicevuti$3.onClick(ACT_MessaggiRicevuti.java:188)
11-22 17:59:36.520: E/AndroidRuntime(8124): at android.view.View.performClick(View.java:3110)
11-22 17:59:36.520: E/AndroidRuntime(8124): at android.view.View$PerformClick.run(View.java:11934)
11-22 17:59:36.520: E/AndroidRuntime(8124): at android.os.Handler.handleCallback(Handler.java:587)
11-22 17:59:36.520: E/AndroidRuntime(8124): at android.os.Handler.dispatchMessage(Handler.java:92)
11-22 17:59:36.520: E/AndroidRuntime(8124): at android.os.Looper.loop(Looper.java:132)
11-22 17:59:36.520: E/AndroidRuntime(8124): at android.app.ActivityThread.main(ActivityThread.java:4123)
11-22 17:59:36.520: E/AndroidRuntime(8124): at java.lang.reflect.Method.invokeNative(Native Method)
11-22 17:59:36.520: E/AndroidRuntime(8124): at java.lang.reflect.Method.invoke(Method.java:491)
11-22 17:59:36.520: E/AndroidRuntime(8124): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
11-22 17:59:36.520: E/AndroidRuntime(8124): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
11-22 17:59:36.520: E/AndroidRuntime(8124): at dalvik.system.NativeStart.main(Native Method)