2
所以當我使用int location = cursor.getColumnIndex(_ID)
它總是返回零,儘管long locationId = cursor.getlong(getColumnIndex(_ID)
返回7.爲什麼我得到不同的值?getColumnIndex(_ID)返回零,getlong(getColumnIndex(_ID))=正確的值
if (locationCursor.moveToFirst()) {
//This is where the problem is happening
locationId = locationCursor.getLong(locationCursor.getColumnIndex(WeatherContract.LocationEntry._ID));
//=7
int location = locationCursor.getColumnIndex(WeatherContract.LocationEntry._ID);
// = 0