728x90
이렇게 끝이 {}이면
Call<BookInfoWithBool> call = getNetworkManager().getBookApi().getListWithSearch(name);
call.enqueue(new Callback<BookInfoWithBool>() {
@Override
public void onResponse(Call<BookInfoWithBool> call, Response<BookInfoWithBool> response) {
BookInfoWithBool bookInfoWithBools = response.body();
if (response.isSuccessful()) {
BookInfo bookInfo = (BookInfo) bookInfoWithBools.getBookInfoList();
Boolean isExist = bookInfoWithBools.getIsExist();
Toast.makeText(RecommendDetailActivity.this, bookInfo.getBook_name() + " !!", Toast.LENGTH_SHORT).show();
// adapter = new RecyclerViewAdapter(getApplicationContext(), books, tagNames);
// recyclerView.setAdapter(adapter);
} else {
Toast.makeText(RecommendDetailActivity.this, "오류가 발생했습니다.", Toast.LENGTH_SHORT).show();
}
}
@Override
public void onFailure(Call<BookInfoWithBool> call, Throwable t) {
Toast.makeText(RecommendDetailActivity.this, "오류가 발생했습니다.", Toast.LENGTH_SHORT).show();
}
});
이렇게 받아도 되고,
이렇게 끝이 [] 이면
Call<List<Tag>> list = getNetworkManager().getBookApi().getTags(accessToken, idToken, refreshToken);
list.enqueue(new Callback<List<Tag>>() {
@Override
public void onResponse(Call<List<Tag>> call, Response<List<Tag>> response) {
List<Tag> tags = response.body();
tagNames.setAllTags(tags);
for (int i = 0; i < tagNames.getAllTags().size(); i++)
flowLayout.addTag(tagNames.getAllTags().get(i));
}
@Override
public void onFailure(Call<List<Tag>> call, Throwable t) {
Toast.makeText(MainActivity.this, "오류가 발생했습니다.", Toast.LENGTH_SHORT).show();
}
});
이렇게 <List<Tag>>로 가져오기1
'Development > Android' 카테고리의 다른 글
[Android] Confirm Message 띄우기 (0) | 2019.03.10 |
---|---|
[Android] BaseApplication, BaseActivity 활용하기 / 자동로그인 로그아웃 by using LocalStore (0) | 2019.03.09 |
[Android] 배포용 apk 만들기 (0) | 2019.03.01 |
[Android] 시작화면 바꾸기 LAUNCHER (0) | 2019.02.07 |
editText focus 없애기 (0) | 2019.01.26 |