DigimonAPI
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package com.example.apidigimon;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import com.bumptech.glide.Glide;
|
||||
|
||||
public class DetailsActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_details);
|
||||
|
||||
ImageView img = findViewById(R.id.imgDetalhe);
|
||||
TextView nome = findViewById(R.id.txtNomeDetalhe);
|
||||
TextView level = findViewById(R.id.txtLevelDetalhe);
|
||||
|
||||
// Receber o objeto Digimon que foi enviado
|
||||
Digimon d = (Digimon) getIntent().getSerializableExtra("digimon_clicado");
|
||||
|
||||
if (d != null) {
|
||||
nome.setText(d.getName());
|
||||
level.setText("Level: " + d.getLevel());
|
||||
Glide.with(this).load(d.getImg()).into(img);
|
||||
}
|
||||
}
|
||||
|
||||
public void voltar(View v) {
|
||||
finish(); // Fecha esta tela e volta para a lista
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user