GetLong (int) method - undefined for SherlockFragmentList

I want to show the contact list in the SherlockFragmentList tab in the tab in the action bar. I follow the Android development tutorial , but I get the following error when I try to get id values ​​inside the onItemClick method: (The getLong (int) method is undefined for the ContactListFragment type)

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); } 

Any help here? Thanks

+4
source share
1 answer

I think the cursor missing, see also 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); 

EDIT: Filled error 59330 for this issue

+6
source

Source: https://habr.com/ru/post/1498646/


All Articles