配列リストの選択場所の項目を削除したい
私のコードは
List<String> historylist = Arrays.asList(history);
if (historylist.size()>=3){
System.out.print("*************************************************");
Log.i(MyContants.StoredHistory_TAG,"StoredHistory size========="+ String.valueOf(historylist.size()));
String removePosition=historylist.get(2);
historylist.remove(removePosition);
}
しかし、例外UnsupportedOperationExceptionが発生しました
エラー
12-20 09:16:27.680: I/StoredHistory Class(5715): StoredHistory size=========3
12-20 09:16:27.680: D/AndroidRuntime(5715): Shutting down VM
12-20 09:16:27.684: W/dalvikvm(5715): threadid=1: thread exiting with uncaught exception (group=0x4001d7d0)
12-20 09:16:27.688: E/AndroidRuntime(5715): FATAL EXCEPTION: main
12-20 09:16:27.688: E/AndroidRuntime(5715): java.lang.RuntimeException: Unable to start activity ComponentInfo{****PACKAGE NAME*****}: java.lang.UnsupportedOperationException
12-20 09:16:27.688: E/AndroidRuntime(5715): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
12-20 09:16:27.688: E/AndroidRuntime(5715): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
12-20 09:16:27.688: E/AndroidRuntime(5715): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
12-20 09:16:27.688: E/AndroidRuntime(5715): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
12-20 09:16:27.688: E/AndroidRuntime(5715): at android.os.Handler.dispatchMessage(Handler.java:99)
12-20 09:16:27.688: E/AndroidRuntime(5715): at android.os.Looper.loop(Looper.java:123)
12-20 09:16:27.688: E/AndroidRuntime(5715): at android.app.ActivityThread.main(ActivityThread.java:4627)
12-20 09:16:27.688: E/AndroidRuntime(5715): at java.lang.reflect.Method.invokeNative(Native Method)
12-20 09:16:27.688: E/AndroidRuntime(5715): at java.lang.reflect.Method.invoke(Method.java:521)
12-20 09:16:27.688: E/AndroidRuntime(5715): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
12-20 09:16:27.688: E/AndroidRuntime(5715): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
12-20 09:16:27.688: E/AndroidRuntime(5715): at dalvik.system.NativeStart.main(Native Method)
12-20 09:16:27.688: E/AndroidRuntime(5715): Caused by: java.lang.UnsupportedOperationException
12-20 09:16:27.688: E/AndroidRuntime(5715): at java.util.AbstractList.remove(AbstractList.java:645)
12-20 09:16:27.688: E/AndroidRuntime(5715): at java.util.AbstractList$SimpleListIterator.remove(AbstractList.java:77)
12-20 09:16:27.688: E/AndroidRuntime(5715): at java.util.AbstractCollection.remove(AbstractCollection.java:230)
12-20 09:16:27.688: E/AndroidRuntime(5715): at ******.utills.StoredHistory.storedHistorylist(StoredHistory.java:24)
12-20 09:16:27.688: E/AndroidRuntime(5715): at *******.ScanResult.onCreate(ScanResult.java:53)
12-20 09:16:27.688: E/AndroidRuntime(5715): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
12-20 09:16:27.688: E/AndroidRuntime(5715): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
12-20 09:16:27.688: E/AndroidRuntime(5715): ... 11 more
この問題を解決する方法..事前の感謝の男