showing cursor position not value

I have the below code:

public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
  mSelectedContact = (NameOfList)parent.getItemAtPosition(position);
  if(mSelectedContact != null){
    String dn = mSelectedContact.getDisplayName();

    // Talking about this line here:
    String num = (mSelectedContact.getPhoneNumbers().toString()); 

    Log.i(TAG, dn + num);
    setContentView(R.layout.main1);
    LinearLayout mainLayout = (LinearLayout)findViewById(R.id.main_layout_id);
    LinearLayout Details = (LinearLayout)getLayoutInflater().inflate(R.layout.layout_item, null);
    TextView DisplayName = (TextView)Details.findViewById(R.id.contactsListView);                                       
    DisplayName.setText((dn) + (num));

    mainLayout.addView(Details);
  }
}
};

I want the marked line to show the value of the phone numbers but it shows the cursor position like:

John Doe[android@40598908, android@40598800]

How would I get the value of the numbers?

Answers


Maybe You just need to write String num = (mSelectedContact.getPhoneNumbers()); without toString() , because in Java toString() method returns a string representation of object like android@40598908.


Need Your Help

Crashing: Attempted to read or write protected memory c#

c# memory crash

We have a periodic crashing problem with our software. I think I have tracked down where it is happening but I am unfamiliar with the code. It's extremely difficult to debug.

Can't Select today's date on uidatepicker ( already pre-selected)

iphone ios ipad uidatepicker

I added a UIDatePicker in my IOS app which get loaded by default with today's date selected.