-
-
Save parzibyte/94a0bfd4a04142084a1b8248112697f0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package me.parzibyte.sumarnmeros; | |
import android.content.Intent; | |
import android.os.Bundle; | |
import android.support.v7.app.AppCompatActivity; | |
import android.widget.TextView; | |
public class Actividad2 extends AppCompatActivity { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_actividad2); | |
// Obtener los datos que nos pasaron. El 0 es por si no se nos pasara | |
// nada, ya que se necesita un valor por defecto (defaultValue) | |
Intent intent = getIntent(); | |
int sumaQueNosPasaron = intent.getIntExtra("suma", 0); | |
// Obtener Widget de vista | |
TextView textView = findViewById(R.id.textView); | |
// Armar un mensaje | |
String mensaje = "La suma es: " + sumaQueNosPasaron; | |
// Y ponerle la suma | |
textView.setText(mensaje); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment