- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我想在操作栏的选项卡上的 SherlockFragmentList 上显示联系人列表。我关注android develop tutorial但是当我尝试在 onItemClick 方法中获取 id 值时出现以下错误:(方法 getLong(int) 未为类型 ContactListFragment 定义)
public class ContactListFragment extends SherlockListFragment implements LoaderCallbacks<Cursor>,
AdapterView.OnItemClickListener {
@Override
public void onItemClick(AdapterView<?> parent, View item, int position, long rowID) {
//Get The Cursor
Cursor cursor = ((SimpleCursorAdapter) parent.getAdapter()).getCursor();
//move to the selected contact
cursor.moveToPosition(position);
//get the id value
mContactId = getLong(CONTACT_ID_INDEX);
mContactKey = getString(LOOKUP_KEY_INDEX);
mContactUri = Contacts.getLookupUri(mContactId, mcontactKey);
}
这里有什么帮助吗?谢谢
最佳答案
我认为缺少一个光标
,另见reference :
Cursor cursor = ((SimpleCursorAdapter) parent.getAdapter()).getCursor();
//move to the selected contact
cursor.moveToPosition(position);
//get the id value
mContactId = cursor.getLong(CONTACT_ID_INDEX);
mContactKey = cursor.getString(LOOKUP_KEY_INDEX);
编辑:填充错误 59330对于这个问题
关于android - SherlockFragmentList 未定义方法 getLong(int),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18408284/
我正在尝试通过JDBC将Spark DataFrame写入Oracle表。我能够成功地连接和查询数据库,但当我创建一个新表时,如下所示:。我收到错误消息java.sql.SQLException:无效
我使用 Android Studio。 例如如果“int”是这样的。 1 getResources().getIntger(R.integer.test_int); 如果是这样,你如何编程“长”? 1
我有以下代码可以从我的 xml 首选项文件中获取长值, SharedPreferences getPrefs = PreferenceManager.getDefaultSharedPreferenc
本文整理了Java中java.time.Year.getLong()方法的一些代码示例,展示了Year.getLong()的具体用法。这些代码示例主要来源于Github/Stackoverflow/M
本文整理了Java中java.time.ZoneOffset.getLong()方法的一些代码示例,展示了ZoneOffset.getLong()的具体用法。这些代码示例主要来源于Github/Sta
本文整理了Java中java.time.ZonedDateTime.getLong()方法的一些代码示例,展示了ZonedDateTime.getLong()的具体用法。这些代码示例主要来源于Gith
我想在操作栏的选项卡上的 SherlockFragmentList 上显示联系人列表。我关注android develop tutorial但是当我尝试在 onItemClick 方法中获取 id 值
本文整理了Java中com.yahoo.memory.WritableMemory.getLong()方法的一些代码示例,展示了WritableMemory.getLong()的具体用法。这些代码示例
本文整理了Java中facebook4j.internal.util.z_F4JInternalParseUtil.getLong()方法的一些代码示例,展示了z_F4JInternalParseUt
我有一个双变量 Double doubleGrandTotal = 500.00; 我像这样将它存储在 SharedPreferences 中: editor.putFloat("key_grand_
我正在研究一个非常简单的 ByteBuffer 用于 java 1.4。我有一个小骨架,基本上只有 put/getInt() put/getLong() 的实现很差。我的问题是,虽然 putInt 和
在android中,如我们所见附图,我从服务器收到的 json 是“id=-7051563524465472446”但代码 jsonObject.getLong("id") 给出 -705156352
本文整理了Java中org.bukkit.configuration.file.YamlConfiguration.getLong()方法的一些代码示例,展示了YamlConfiguration.ge
本文整理了Java中org.apache.samza.config.YarnConfig.getLong()方法的一些代码示例,展示了YarnConfig.getLong()的具体用法。这些代码示例主
在过去的两个小时里,我一直在调试看似极不可能的事情。我已经将辅助 Android Activity 的方法剥离为: public void onClick(View v) { Stri
本文整理了Java中org.apache.hadoop.yarn.conf.YarnConfiguration.getLong()方法的一些代码示例,展示了YarnConfiguration.getL
本文整理了Java中org.apache.gobblin.runtime.locks.ZookeeperBasedJobLock.getLong()方法的一些代码示例,展示了ZookeeperBase
我收到一条错误消息,指出“SharedPreferences 类型中的方法 getLong(String, long) 不适用于参数 (String)”(一直在我的代码末尾): long oldTi
所以当我使用 int location = cursor.getColumnIndex(_ID) 它总是返回零,尽管 long locationId = cursor.getlong(getColum
下午好, 我遇到了一些问题,我尝试了很多方法来寻找解决方案,但我找不到。 首先,我的问题源自java.sql.SQLException: Invalid value for getLong()。但是,
我是一名优秀的程序员,十分优秀!