Getting Contact Phone Number

穿精又带淫゛_ 提交于 2019-12-01 09:18:12

Shouldn't it be:

while(pCur.moveToNext()){
   phone = pCur.getString(pCur.getColumnIndex(Phone.NUMBER));
   Log.v("getting phone number", "Phone Number: " + phone);
}

That is, pCur instead of the 'c' cursor, which holds the contacts?

You need to reset the cursor before calling "moveToNext()". Just call "pCur.moveToFirst();" right before the while. That should help.

i got it, i took out the while loop and i get the number fine now

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!