android – How do I make the NewsAPI search a specific term?-ThrowExceptions

Exception or error:

I have the NewsAPI connected to my Android application. It shows the top headlines in a CardView. However, I’m wondering how I can set it so that it shows the headlines related to a specific term.

For instance, if I wanted it to show just the headlines that have the word “Politics” in relation to them, how would I go about that?

NewsAPI Link –

import retrofit2.Call;
import retrofit2.http.GET;
import retrofit2.http.Query;

public interface NewsApiInterface {

    Call<Headlines> getHeadlines(
            @Query("country") String country,
            @Query("apiKey") String apiKey

    Call<Headlines> getSpecificData(
        @Query("q") String query,
        @Query("apiKey") String apiKey

How to solve:

Leave a Reply

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