We want to connect the people who have knowledge to the people who need it, to bring together people with different perspectives so they can understand each other better, and to empower everyone to share their knowledge.
btn_start.setOnClickListener(view -> { if (txt_cms_address.getText() != null) { cmsAddress = txt_cms_address.getText().toString(); Log.d(TAG, "CMS" + cmsAddress); APIRegisterDisplay(); // APISchedule(); // APIGetRequiredFile(); if (checkConnect) { // APIGetRequiredFile(); // APISchedule(); Log.d(TAG, "check ok"); } else { Log.d(TAG, "check k ok"); } } else { Toast.makeText(this, "Address must not be empty!!", Toast.LENGTH_SHORT).show(); } });
checkConnect == true
if(checkConnect)
if (display != null)
private void APIRegisterDisplay() { RegisterDisplay registerDisplay = new RegisterDisplay(abc, xyz ...); apiService = RetrofitClient.getClient(cmsAddress).create(APIService.class); apiService.Register(registerDisplay).enqueue(new Callback() { @Override public void onResponse(@NonNull Call call, @NonNull Response response) { if (response.isSuccessful()) { assert response.body() != null; JsonObject json = response.body().getAsJsonObject("response").getAsJsonObject("display").getAsJsonObject("$"); Gson gson = new GsonBuilder().setPrettyPrinting().create(); String string = gson.toJson(json); Display display = gson.fromJson(string, Display.class); if (display != null) { if (display.getCode().equals("0")) { //code == 0 Display is active and ready to start Toast.makeText(getApplicationContext(), display.getMessage(), Toast.LENGTH_SHORT).show(); Log.d(TAG, "get display successful"); checkConnect = true; } else { Toast.makeText(getApplicationContext(), display.getMessage(), Toast.LENGTH_SHORT).show(); } } else { Log.d(TAG, "failed"); Toast.makeText(getApplicationContext(), "Unable to connect to CMS!!", Toast.LENGTH_SHORT).show(); } } } @Override public void onFailure(@NonNull Call call, @NonNull Throwable t) { Log.e(TAG, "REGISTER_DISPLAY:" + t.getLocalizedMessage()); } }); }
checkConnect
display.getCode()
2.2K Point(s)
1.2K Point(s)
313 Point(s)
178 Point(s)
138 Point(s)
Input your email to receive reset password link, or if you remember your password, you can click