Нужна помощь, пожалуйста .... я получаю категории успешно .... но я не могу понять, как получить подкатегории для каждой категории ...
https://themographics.com/wordpress/doc_api/wp-json/api/v1/post_type/get_categories
это ссылка на URL
получение кода категории:
public void getcategory () {
Call<List<UserCatagories>> call = RetrofitClient.getInstance().getApi().getCatagories();
call.enqueue(new Callback<List<UserCatagories>>() {
@Override
public void onResponse(Call<List<UserCatagories>> call, Response<List<UserCatagories>> response) {
List<UserCatagories> catagories =response.body();
for (UserCatagories C : catagories){
Log.d("catagories" , C.getCatagories());
String[] catagoriesname = new String[catagories.size()];
for (int i=0 ; i<catagories.size() ; i++){
catagoriesname[i]= catagories.get(i).getCatagories();
}
listview.setAdapter(new ArrayAdapter<String>(
getApplicationContext() ,
android.R.layout.simple_spinner_dropdown_item,
catagoriesname
){
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View view =super.getView(position, convertView, parent);
TextView textView=(TextView) view.findViewById(android.R.id.text1);
textView.setTextColor(Color.BLACK);
return view;
}
});
}
}
@Override
public void onFailure(Call<List<UserCatagories>> call, Throwable t) {
Toast.makeText(Category.this , t.getMessage() , Toast.LENGTH_SHORT).show();
}
});
}
Интерфейс API:
@GET ( "post_type / get_categories")
Call> getCatagories ();