I'm just learning Java and here I'm presented with this strange error message. In the code below:
while (phones_cursor.moveToNext())
{
String name = phones_cursor.getString(phones_cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME));
}
Log.wtf("Name: ", name);
I'm get this message saying that "name" cannot be resolved to a variable. So I suppose name is local to the while loop. I wonder now however, how do I get this variable out of the while loop?