主场迎战的getItem getItemAtPosition [英] getItem vs. getItemAtPosition

查看:217
本文介绍了主场迎战的getItem getItemAtPosition的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有得到一个列表视图中选择项目的2种方式。

There are 2 ways of getting selected Item of a list view.


  1. list.getAdapter()的getItem(位置);

  2. list.getItemAtPosition(位置)

  1. list.getAdapter().getItem(position);
  2. list.getItemAtPosition(position)

我的问题是,哪一个是做它的preferred方式?

My question is, which one is the preferred way of doing it?

我见过的人同时使用。

推荐答案

您可以使用任何你想要哪一个。 getItemAtPosition(位置)基本上使得与的getItem(位置)到适配器通话,这是同样的事情。

You can use which one you want. getItemAtPosition(position) basically makes a call to the adapter with getItem(position), it's the same thing.

这篇关于主场迎战的getItem getItemAtPosition的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆