Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Build a Self-Destructing Message Android App Retrieving and Viewing Messages Retrieving Messages

stage 7 challenge 2

Next, filter the query using a "where" clause. In this case, we want to filter episodes where the field "writer" is equal to the string value "Neil Gaiman".

MainActivity.java
import android.app.Activity;
import android.os.Bundle;
import com.parse.ParseQuery;
import com.parse.ParseObject;
import com.parse.FindCallback;

public class MainActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        /* Add code below! */
     ParseQuery<String> query = new ParseQuery<String>("DoctorWhoEpisodes"); 
      query.whereEqualTo(ParseConstants.KEY_RECIPIENT_IDS,ParseUser.getCurrentUser().getObjectId());  
    }
}

l need your help l am stuck...thank you in advance

1 Answer

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

If you look at the documentation for ParseQuery you will find the method being used here, whereEqualsTo(). Here is the relevant description from Parse.com:

public ParseQuery<T> whereEqualTo(String key, Object value)

Add a constraint to the query that requires a particular key's value to be equal to the provided value.

Parameters:

key - The key to check.

value - The value that the ParseObject must contain.

Returns:

Returns the query, so you can chain this call.

In our challenge we want to check to see where the field "writer" is equal to the string value "Neil Gaiman". Since we have already defined a ParseQuery object as query we can use:

query.whereEqualTo("writer", "Neil Gaiman");

I hope that helps and makes some sense.

Happy coding,

Ken

THANKS