为什么我们在改造中使用界面

bla*_*awk 5 java oop android retrofit

在进行网络请求时,retrofit 如何利用接口,首先我们定义接口并将其传递给retrofit 的创建方法,这些东西是如何协同工作的

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();
        } 
Run Code Online (Sandbox Code Playgroud)