title: retrieve contact's nickname, part 2
body: <p>A few weeks ago I asked exactly the same question <a href="https://stackoverflow.com/questions/3053554/retrieve-contacts-nickname">here</a>. At first, I thought the answers solved my problem, but they didn't. I just didn't notice that I wasn't able to solve my problem with those answers.</p>
  
  <p>However, what I've got now is:</p>
  
  <pre><code>final Cursor phoneCursor = context.getContentResolver().query(Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, Uri.encode("'" + incomingNumber + "'")), null, null, null, null);
  phoneCursor.moveToFirst();
  
  String lookupString = phoneCursor.getString(phoneCursor.getColumnIndex(PhoneLookup.LOOKUP_KEY));
  
  final Cursor dataCursor = context.getContentResolver().query(ContactsContract.Data.CONTENT_URI, null, ContactsContract.Data.LOOKUP_KEY + "=" + "'" + lookupString + "'", null, null);
  dataCursor.moveToFirst();
  
  Log.e("smn", "display_name: " + dataCursor.getString(dataCursor.getColumnIndex(ContactsContract.Data.DISPLAY_NAME)));
  Log.e("smn", "nickname: " + dataCursor.getString(dataCursor.getColumnIndex(ContactsContract.Data.DATA1)));
  </code></pre>
  
  <p>Output looks like this:</p>
  
  <pre><code>08-14 17:41:02.106: ERROR/smn(20146): display_name: Tom Tasche
  08-14 17:41:02.106: ERROR/smn(20146): nickname: null
  </code></pre>
  
  <p><a href="https://stackoverflow.com/questions/3053554/retrieve-contacts-nickname/3054083#3054083">This answer</a> told me that Nicknames are held in Data-table, but although I'm querying Data-table, I don't retrieve the contact's alias saved in my addressbook.</p>
  
  <p><img src="https://dl.dropbox.com/u/811795/device.png" alt="contact with alias"></p>
  
  <p>I already tried it the other way: I inserted a new alias for this contact. And that worked fine. So, nicknames seem to work.
  Additionally, I've printed out every field that's saved in Data-table, again, without no luck.</p>
  
  <p>Any ideas? Maybe I'm doing something completely wrong, but at the moment I don't see what's the problem...</p>
  
  <p>Thanks for your help</p>
  
  <p>Tom</p>