2012-05-22 17 views
0

我有兩個班的機器人測試項目:怪異的行爲從ArrayAdapter

  1. AdapterTestActivity延伸ListActivity - >http://pastebin.com/BreRSPj1
  2. MyAdapter延伸ArrayAdapter - >http://pastebin.com/YUK4CRQq

System.out.println()MyAdapter我得到此打印輸出:

05-22 16:43:03.942: I/System.out(17943): test 1 
05-22 16:43:03.942: I/System.out(17943): test 2 
05-22 16:43:03.950: I/System.out(17943): test 3 
05-22 16:43:04.098: I/System.out(17943): test 1 
05-22 16:43:04.098: I/System.out(17943): test 2 
05-22 16:43:04.098: I/System.out(17943): test 3 
05-22 16:43:04.106: I/System.out(17943): test 1 
05-22 16:43:04.106: I/System.out(17943): test 2 
05-22 16:43:04.106: I/System.out(17943): test 3 

,但我希望是這樣的:

test 1 
test 2 
test 3 

有誰知道爲什麼嗎? - 謝謝!

回答

1

這不是一個奇怪的行爲,但它是框架的實現細節。無法保證在哪個或哪些訂單或調用了多少次getView()

0

併爲您的第二個問題,你可能需要添加:

_adapter.notifyDataSetChanged(); 

加入你的「測試4」

+0

哦確定,也沒有第二個問題了...之後 – elgui