facebook - Feed post functionality using MultiAutoCompleteTextview Android

I am trying to build a social networking application which is having feed post functionality same like Facebook or Instagram.

This includes tagging friends and adding hash tags. I have achieved the functionality to tag a friend using MultiAutoCompleteTextView. It works in the following way:

1) When I type @ then it populates the list of my friends.

2) When I click any particular friend it got added in the feed description area.

But the problem is that suppose I tag a friend in my post then again he would not be listed in the list of MultiAutoCompleteTextView drop down so that one friend can be tagged once.

Suppose i have removed that tagged friend from the description then only it would be visible again in the MultiAutoCompleteTextView drop down.

Any help would be deeply appreciated.

2 Answers

  1. Oliver- Reply

    2019-11-14

    First of all where is the user-list source coming from? If the source coming from your own server you could easily sending the userID to the server to tell your database to not query specific userID. This approach is very good in the case if you using LIMIT, if your user try to tag all the people with starting name John then if your record return only 15 record once your user will not getting any data.

    Second method will be just using a ArrayList<> to store the user which you already click. Then you could check something like this

    if(!arrayList.contains("key")){
        result.add("key");
    }
    

    Which arrayList is where you store your value of user. If it doesn't contain in that arrayList mean it doesn't selected by the user just go ahead add it into your array. It is just suggestion you need to think how to integrate to your app.

    Here is the thing you could mention repeatly with same user in instagram or facebook. If it doesn't contain in the drop down list your user still can typing in the same character to mention that user again so if you worry about notification or something it is better to check for that as well. social application is very hard took me year to built a good one.

  2. Oscar- Reply

    2019-11-14

    The ListView All automatically populate when you type @. For this, Use Custom AutoComplete TextView

Leave a Reply

Your email address will not be published. Required fields are marked *

You can use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>