getting structure name return each time only first contact given name. android
<p>hi frnds i want to fetch all the given name in contact list but each time when i cal l this method it returns first value of contact  list in each time pls take a look  below in my code below. how to i read next value when getName(long _id) method call each time....             </p>

<pre><code>public String [] getName(long _id)
{
    String Given = null ;
    String family = null ;
    try {
        String whereName = ContactsContract.Data.MIMETYPE + " = ?";
        String[] whereNameParams = new String[] { ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE };
        Cursor cursor = getContentResolver().query(ContactsContract.Data.CONTENT_URI, null, whereName, whereNameParams, ContactsContract.CommonDataKinds.StructuredName.GIVEN_NAME);

        if(cursor != null) {
            while (cursor.moveToNext()) {  
                // This would allow you get several email addresses  
                // if the email addresses were stored in an array  
                Given = cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.StructuredName.GIVEN_NAME));
                // family = cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.StructuredName.FAMILY_NAME));

                // TODO Auto-generated method stub
                if(Given != null)
                    break;
            }
        }       
    } catch (Exception e) {
        Log.i("test", "Exception " + e.toString());
    } finally {
        if(cursor != null) {
            cursor.deactivate();
            cursor.close();             
        }
    }
    //return emailid;
    //return emailType;

    Log.i("RETURN given name.....", Given);   
    return new String[] { Given};       
}
</code></pre>
