将类别列表存储在静态变量中以在其他活动中使用

时间:2018-09-23 07:18:07

标签: android

我使用retrofit2并获取类别列表。 我使用模式类和recyclerview适配器并使用:

获取类别
private void CatsRequest(){

        APIInterface apiInterface = APIClient.getClient().create(APIInterface.class);
        Call<List<Category>> call =  apiInterface.getCategories();
        call.enqueue(new Callback<List<Category>>() {
            @Override
            public void onResponse(Call<List<Category>> call, Response<List<Category>> response) {
                hidePDialog();
                if(response.isSuccessful()){
                    List<Category> cats =  response.body();
                    setupRecyclerView(cats);
                }
            }

            @Override
            public void onFailure(Call<List<Category>> call, Throwable t) {

            }
        });
    }

类别包括标题和ID。 我想将此标题存储在静态变量中,并在其他活动中使用它们,并与微调框一起显示。

0 个答案:

没有答案