| :
ckage com.example.covidtracker; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.widget.TextView; import com.example.covidtracker.api.ApiUtilities; import com.example.covidtracker.api.CountryData; import com.example.covidtracker.api.CountryDetails; import java.text.NumberFormat; import java.util.List; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; public class CountryActivity extends AppCompatActivity { private TextView countryCases, countryRecovered, countryCritical, countryActive, countryTodayCases, countryTotalDeaths, countryTodayDeaths, countryTests; private String countryName; private static final String TAG = "CountryActivity"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_country); countryName = getIntent().getStringExtra("country"); Log.d(TAG, "onCreate: " + countryName); initViews(); getCountryDetails(); } private void getCountryDetails() { Call> call = ApiUtilities.getApiInterface().getCountryData(); call.enqueue(new Callback>() { @Override public void onResponse(Call> call, Response> response) { List countryDetails = response.body(); for (int i = 0; i < countryDetails.size(); i++) { if (countryDetails.get(i).getCountry().equals(countryName)) { int cases = Integer.parseInt(countryDetails.get(i).getCases()); int recovered = Integer.parseInt(countryDetails.get(i).getRecovered()); int critical = Integer.parseInt(countryDetails.get(i).getCritical()); int active = Integer.parseInt(countryDetails.get(i).getActive()); int todayCases = Integer.parseInt(countryDetails.get(i).getTodayCases()); int totalDeaths = Integer.parseInt(countryDetails.get(i).getDeaths()); int todayDeaths = Integer.parseInt(countryDetails.get(i).getTodayDeaths()); int tests = Integer.parseInt(countryDetails.get(i).getTests()); countryCases.setText(NumberFormat.getInstance().format(cases)); countryRecovered.setText(NumberFormat.getInstance().format(recovered)); countryCritical.setText(NumberFormat.getInstance().format(critical)); countryActive.setText(NumberFormat.getInstance().format(active)); countryTodayCases.setText(NumberFormat.getInstance().format(todayCases)); countryTotalDeaths.setText(NumberFormat.getInstance().format(totalDeaths)); countryTodayDeaths.setText(NumberFormat.getInstance().format(todayDeaths)); countryTests.setText(NumberFormat.getInstance().format(tests)); } } } @Override public void onFailure(Call> call, Throwable t) { } }); } private void initViews() { countryCases = findViewById(R.id.countryCases); countryRecovered = findViewById(R.id.countryRecovered); countryCritical = findViewById(R.id.countryCritical); countryActive = findViewById(R.id.countryActive); countryTodayCases = findViewById(R.id.countryTodayCases); countryTotalDeaths = findViewById(R.id.countryTotalDeaths); countryTodayDeaths = findViewById(R.id.countryTodayDeaths); countryTests = findViewById(R.id.countryTests); } }
ǸҳܰȨ۳ʱ踶ѹ
˴
ɨ븶Ѽɸ
物理信号 | 物理信道 | PCI冲突 | RRC INACTIVE | PCelI | PRH | BPSKM | SSREF | costom edge | 用户边缘路由器 | 卫星通信协议 | 卫星通信信令 |