35 lines
1.1 KiB
Java
35 lines
1.1 KiB
Java
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
|
|
}
|
|
}
|