There is a database with data, in turn I take the data and pass it to the request. It is necessary to perform enumeration of all data, that is, send conditionally 7 requests in a row, receiving a response from the server to check what has come, if the error continues, if the normal response is to finish sending the requests. Tried through a while , nothing happened. Tell me please.
public void methodWhile(){ while (true){ macc = arrayMac[d]; mRquest(macc); Log.d("qwe", "Ответ с сервера = " + code); if (code == 1 || code == 2){ Log.d("qwe","true"); schag++; d++; Log.d("qwe", "Кол-во шагов " + schag); // break; } else { Log.d("qwe","false"+ "" + code); break; } } } public void mRquest(String bmac){ Map<String, String> query = new HashMap<String, String>(); query.put("bmac",bmac); query.put("cmac", mydeviceAddress); query.put("rsi", "-50"); //Response response = service.search(parameters); Log.d("qwe", "Map Created"); apiService.search(query); Call<Example> call = apiService.search(query); call.enqueue(new Callback<Example>() { @Override public void onResponse(Call<Example> call, Response<Example> response) { if (response.isSuccessful()) { Example mExample = response.body(); Log.d("qwe", "Запрос выполнился успешно"); } else { Log.d("qwe", "Сервер вернул ошибку"); } } @Override public void onFailure(Call<Example> call, Throwable t) { Log.d("qwe", "Произошла ошибка при выполненни запроса"); } }); }