why we use interface in retrofit

Viewed 601

How retrofit make use of interface when making network request, first we define interface and pass it to create method of retrofit how does these things work together

BooksAPI api = adapter.create(BooksAPI.class);

    //Defining the method
    api.getBooks(new Callback<List<Book>>() {
        @Override
        public void success(List<Book> list, Response response) {

            //Storing the data in our list
            books = list;

            //Calling a method to show the list
            showList();
        } 
0 Answers
Related