0

Нужно, чтобы поток запускался сново через каждые 15 секунд. Внутри потока происходит обращение к серверу.

Thread t = new Thread(new Runnable() {
            public void run() {
                try {
                    for(int i = 0; i < 270; i++) {
                        final Response response =  requestInterface.getCard().execute();
                        getActivity().runOnUiThread(new Runnable() {
                            @Override
                            public void run() {
                                items.add((Card)response.body());
                                recyclerView.getAdapter().notifyDataSetChanged();
                            }
                        });
                    }

                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        });
        t.start();
2

0

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Посмотрите другие вопросы с метками или задайте свой вопрос.