0

我在任何地方都没有看到明确的答案:ArrayAdapter.insert() 是否在指定位置插入项目..或者..它是否替换了指定位置的信息?

4

3 回答 3

6

它插入一个新项目。它不会更改或删除以前存在的任何项目。

于 2013-01-31T14:14:40.703 回答
0

insert(T object, int index) 在数组中的指定索引处插入指定对象。并且随后不影响当前项目index

文档在这里

于 2013-01-31T14:15:19.590 回答
0

它在指定索引处的现有项目之间插入新项目。请参阅http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/1.6_r2/android/widget/ArrayAdapter.java

它进一步调用 ArrayList<>.add() Inserts the specified element at the specified position in this list. Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).

于 2013-01-31T14:15:30.027 回答