Retrieving list of users in my Android App through Parse that match my Phone Contact List

DOLI CHATTERJEE

I am developing a Android Chat Messaging App Using Parse where I am saving user's phone number, username and password during the sign up process that I have completed successfully. Now I want to fetch the list of users already saved under the Phone Contact list matching their phone numbers and display the users in a list view. I am stuck of writing the Parse query and showing the fetched users in a list view.

EDIT: I am trying to play around the following code, but clueless yet.

ParseUser user1 = ParseUser.getCurrentUser();
ParseQuery<ParseUser> parseQuery = user1.getQuery();
parseQuery.whereEqualTo("PhoneNumber", some_ph_no_from_my_contact);
parseQuery.findInBackground(new FindCallback<ParseUser>() {

    @Override
    public void done(List<ParseUser> numberList, ParseException e) {
        // TODO Auto-generated method stub

        if(e == null){
            for (int i = 0; i < numberList.size(); i++) 
            {
                // What to do here?
            }
        }
        else{
            Log.d("userId", "Error: " + e.getMessage());
        }
    }
});

Please help.

David Corsalini

You can use a OR query:

public void getFriends(List<String> numbers) {
    List<ParseQuery<ParseUser>> queries = new ArrayList<ParseQuery<ParseUser>>();
    for (String number : numbers) {
        ParseQuery<ParseUser> parseQuery = ParseUser.getQuery();
        parseQuery.whereEqualTo("PhoneNumber", number);
        queries.add(parseQuery);
    }

    ParseQuery<ParseUser> userQuery = ParseQuery.or(queries);

    userQuery.findInBackground(new FindCallback<ParseUser>() {

        @Override
        public void done(List<ParseUser> numberList, ParseException e) {
            if (e == null) {
                for (int i = 0; i < numberList.size(); i++) {
                    // What to do here?

                    //Use this list of ParseUser (numberList) in an ArrayAdapter
                    //or save it in a database
                }
            }
        }
    });
}

List<String> numbers would be the list of phone numbers from the user's addressbook.

Once you have the List<ParseUser> just feed it to an ArrayAdapter<ParseUser> or save it in a local database, your choise (I'd go with the database).

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

How can I send message to specific contact through WhatsApp from my android app?

分類Dev

How to register my app so that it appears in the phote edit list in windows phone 8.1 runtime

分類Dev

Retrieving the user name and email id from Facebook into my android app

分類Dev

Can't install Titanium's app on my android 2.3.6 phone

分類Dev

my android app doesn't parse the data generated by php

分類Dev

How to pick item from another list if my conditions match?

分類Dev

Getting filtered list values from all users in my firebase Realtime-Database where the list is a child of user

分類Dev

How to make my app appear in share list in vue native?

分類Dev

How do I get my app to appear in the Applications list?

分類Dev

unregistered users can login into my firebase app

分類Dev

Please help my app keeps crashing on my phone and Emulator

分類Dev

how to list all pdf files in my android device

分類Dev

My cordova webview app is really slower than in the android browser on the same phone

分類Dev

My text is half visible when i want to add a name to my list (SQLite) Android

分類Dev

How can pandas str.extract method returns more match from my list?

分類Dev

Accordion is not working in my android app

分類Dev

How to identify a local phone contact and an SYNC phone contact in android?

分類Dev

Android Editext selecting multiple contacts from Contact List

分類Dev

Open phone settings when button is clicked in my app

分類Dev

How to know what date my app was published in Windows Phone Store?

分類Dev

Having trouble with my contact form

分類Dev

Allow users to use custom domain to my cloudfront app

分類Dev

Allow users to use custom domain to my cloudfront app

分類Dev

Can I share my Hangout App with other users?

分類Dev

In a Flask app, how to print each item of a list in the new paragraphs inside my HTML page

分類Dev

Why is my code not rendering a list of table on my web page?

分類Dev

Bootstrap HTML - my button will appear above my select list, but not below it

分類Dev

Will my app be slow on a device if it's slow on my Android Studio emulator?

分類Dev

How to list all the hostname in my network?

Related 関連記事

  1. 1

    How can I send message to specific contact through WhatsApp from my android app?

  2. 2

    How to register my app so that it appears in the phote edit list in windows phone 8.1 runtime

  3. 3

    Retrieving the user name and email id from Facebook into my android app

  4. 4

    Can't install Titanium's app on my android 2.3.6 phone

  5. 5

    my android app doesn't parse the data generated by php

  6. 6

    How to pick item from another list if my conditions match?

  7. 7

    Getting filtered list values from all users in my firebase Realtime-Database where the list is a child of user

  8. 8

    How to make my app appear in share list in vue native?

  9. 9

    How do I get my app to appear in the Applications list?

  10. 10

    unregistered users can login into my firebase app

  11. 11

    Please help my app keeps crashing on my phone and Emulator

  12. 12

    how to list all pdf files in my android device

  13. 13

    My cordova webview app is really slower than in the android browser on the same phone

  14. 14

    My text is half visible when i want to add a name to my list (SQLite) Android

  15. 15

    How can pandas str.extract method returns more match from my list?

  16. 16

    Accordion is not working in my android app

  17. 17

    How to identify a local phone contact and an SYNC phone contact in android?

  18. 18

    Android Editext selecting multiple contacts from Contact List

  19. 19

    Open phone settings when button is clicked in my app

  20. 20

    How to know what date my app was published in Windows Phone Store?

  21. 21

    Having trouble with my contact form

  22. 22

    Allow users to use custom domain to my cloudfront app

  23. 23

    Allow users to use custom domain to my cloudfront app

  24. 24

    Can I share my Hangout App with other users?

  25. 25

    In a Flask app, how to print each item of a list in the new paragraphs inside my HTML page

  26. 26

    Why is my code not rendering a list of table on my web page?

  27. 27

    Bootstrap HTML - my button will appear above my select list, but not below it

  28. 28

    Will my app be slow on a device if it's slow on my Android Studio emulator?

  29. 29

    How to list all the hostname in my network?

ホットタグ

アーカイブ