Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8724665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:52:37+00:00 2026-06-13T07:52:37+00:00

This is a follow up to my question earlier here: Android: Autocomplete TextView Similar

  • 0

This is a follow up to my question earlier here: Android: Autocomplete TextView Similar To The Facebook App.

The Background:

My requirement in the question (link posted above) was to have an AutoCompleteTextView similar to the one used in the Facebook app and several others too. The solution was to use a multi-line MultiAutoCompleteTextView The idea was to enable users to type their Friends names directly while creating a Status Update. The solution in the answer works fine from a standalone point of view. However, when I stared integrating the solution in my existing code, it still works with the correct drop-down et all. I see the filtered list of my friends thanks to a solution from here: https://stackoverflow.com/a/12363961/1350013. I use a custom ListView with a BaseAdapter instead of the GridView from the solution.

The Problem:

My code makes use of a BaseAdapter which implements Filterable. As mentioned above, works fine.

When I select a Friend from the filtered list, is where the problem is. The MultiAutoCompleteTextView, after selection, displays this: @MY_PACKAGE_NAME.Friends.getFriends@406c1058 instead of the Friend’s name. What would I have to change to show the Name instead of the garbled text? If it helps, the Class I run this in extends a SherlockActivity and not a SherlockListActivity.

Now I am not sure what the relevant code would be to find out where the problem might lie, so I will post as much relevant code as possible. I am a noob, so please be easy and ask for any additional code. I will promptly comply. Likewise, if something here is not needed is cluttering the post, I will remove that.

CODE BLOCKS

The Tokenizer from the solution from my earlier question. Linked at the top (In the onCreate() method)

editStatusUpdate = (MultiAutoCompleteTextView) findViewById(R.id.editStatusUpdate);
editStatusUpdate.addTextChangedListener(filterTextWatcher);

editStatusUpdate.setTokenizer(new Tokenizer() {

    @Override
    public CharSequence terminateToken(CharSequence text) {

        int i = text.length();

        while (i > 0 && text.charAt(i - 1) == ' ') {
            i--;
        }

        if (i > 0 && text.charAt(i - 1) == ' ') {
            return text;
        } else {
            if (text instanceof Spanned) {
                SpannableString sp = new SpannableString(text + " ");
                TextUtils.copySpansFrom((Spanned) text, 0, text.length(), Object.class, sp, 0);
                return sp;
            } else {
                return text.toString() + " ";
            }
        }
    }

    @Override
    public int findTokenStart(CharSequence text, int cursor) {

        int i = cursor;

        while (i > 0 && text.charAt(i - 1) != '@') {
            i--;
        }

        if (i < 1 || text.charAt(i - 1) != '@') {
            return cursor;
        }

        return i;
    }

    @Override
    public int findTokenEnd(CharSequence text, int cursor) {

        int i = cursor;
        int len = text.length();

        while (i < len) {
            if (text.charAt(i) == ' ') {
                return i;
            } else {
                i++;
            }
        }

        return len;

    }
});

The TextWatcher, also from the solution to the earlier question:

private TextWatcher filterTextWatcher = new TextWatcher() {

    @Override
    public void onTextChanged(CharSequence s, int start, int before, int count) {

        Layout layout = editStatusUpdate.getLayout();
        int pos = editStatusUpdate.getSelectionStart();
        int line = layout.getLineForOffset(pos);
        int baseline = layout.getLineBaseline(line);

        int bottom = editStatusUpdate.getHeight();

        editStatusUpdate.setDropDownVerticalOffset(baseline - bottom);

    }

    @Override
    public void beforeTextChanged(CharSequence s, int start, int count,
            int after) {

    }

    @Override
    public void afterTextChanged(Editable s) {

    }
};

For my ArrayList:

public class getFriends {

    String friendID;
    String friendName;
    String friendProfile;

    boolean selected;

    // SET FRIENDS ID
    public void setFriendID(String friendID) {
        this.friendID = friendID;
    }

    // GET FRIENDS ID
    public String getFriendID() {
        return friendID;
    }

    // SET FRIENDS NAME
    public void setFriendName(String friendName) {
        this.friendName = friendName;
    }

    // GET FRIENDS NAME
    public String getFriendName() {
        return friendName;
    }

    // SET FRIENDS PROFILE
    public void setFriendProfile(String friendProfile) {
        this.friendProfile = friendProfile;
    }

    // GET FRIENDS PROFILE
    public String getFriendProfile() {
        return friendProfile;
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T07:52:38+00:00Added an answer on June 13, 2026 at 7:52 am

    Judging by the output you get it appears that your code calls the toString method on your getClass objects to retrieve the data it needs. As you want the friend’s name you should implement your own toString method(by overriding it) like this:

    @Override
    public String toString() {
        return friendName; 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a follow-up to an earlier question I posted on EF4 entity keys
This is a follow up to a question I asked earlier seen here: Confused
This is somewhat of a follow up to a question posted earlier last month.
This Question is Related to my earlier post here: CSS loading issue with Android
This is a follow-up to an earlier question here: CakePHP find statement for a
This is a follow-up question to this question I asked earlier. Btw thanks Neil
This is a follow-on question from the one I asked here . Can constraints
this is a follow-up question to my question earlier this day . I have
This is a follow-up to a question I'd asked earlier which phrased this as
This is a follow up to my earlier question . Tomcat 5.0.28 had a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.