There are 2 ways of getting selected Item of a list view.
list.getAdapter().getItem(position);
list.getItemAtPosition(position)
My question is, which one is the preferred way of doing it?
我看到有人使用这两种方法。
There are 2 ways of getting selected Item of a list view.
list.getAdapter().getItem(position);
list.getItemAtPosition(position)
My question is, which one is the preferred way of doing it?
我看到有人使用这两种方法。
你可以使用你想要的东西。 <代码>getItemAtPosition(position),基本上向适应者发出getItem(position)
的呼吁。
此处是<代码> > 源代码 。 清单编码>。
public Object getItemAtPosition(int position) {
T adapter = getAdapter();
return (adapter == null || position < 0) ? null : adapter.getItem(position);
}
因此,基本情况相同。
另一种答案是不正确的,有一大差别。
当你在一份清单中添加一个标题时,名单就把改编者列入一个标题ListAdapter。 HeaderViewListAdapter s work is translation position
to take the Headers into account.
例如,如果您增加了一个标题<代码>,<> > > > > > 即为背后改编者<代码>0。 如果你试图使用适应器,那么实际上会把第二个项目归还给适应者。
如果你添加了一张头盔,你必须使用清单。
What to look for in performance analyzer in VS 2008 I am using VS Team system and got the performance wizard and reports going. What benchmarks/process do I use? There is a lot of stuff in the ...
We have a number of items coming in from a web service; each item containing an unknown number of properties. We are storing them in a database with the following Schema. Items - ItemID - ...
Are there some noticeable outcomes in terms of performance or other aspects to follow semantic HTML?
I m using Visual Studio 2008 (with the latest service pack) I also have ReSharper 4.5 installed. ReSharper Code analysis/ scan is turned off. OS: Windows 7 Enterprise Edition It takes me a long time ...
As a learning experience I recently tried implementing Quicksort with 3 way partitioning in C#. Apart from needing to add an extra range check on the left/right variables before the recursive call, ...
I ve tried searching for this but it s pretty difficult to put into words. Basically, our site will run fine for most users without any issues. Sometimes though, those of us who use the site pretty ...
Python s paster serve app.ini is taking longer than I would like to be ready for the first request. I know how to profile requests with middleware, but how do I profile the initialization time? I ...
So I m running perl 5.10 on a core 2 duo macbook pro compiled with threading support: usethreads=define, useithreads=define. I ve got a simple script to read 4 gzipped files containing aroud 750000 ...