PROYECTO 2


Datos del alumno (nombre, grupo, especialidad y docente)
Fecha de realización
BRYAN ALEXIS NEGRETE CARRILLO
4°G
Programación
María Lourdes Ramírez Villaseñor
20/04/2018
(Día/mes/año)
Práctica no.
Nombre de la práctica
Parcial

1

Actividad 01: “Layouts en Android”: Proy01_Lista_de_invitados

1

2

X

3

Objetivo: (Describes de qué trata la actividad)
El estudiante realiza aplicaciones móviles que utilicen diferentes layouts, según lo vaya indicando el docente.
Código en XML

<LinearLayout
    
xmlns:android="http://schemas.android.com/apk/res/android"
    
android:orientation="vertical"
    
android:layout_width="match_parent"
    
android:layout_height="match_parent"
    
android:background="@android:color/darker_gray">

    <TextView
        
android:text="Lista de invitados"
        
android:layout_width="wrap_content"
        
android:layout_height="wrap_content"
        
android:background="#4CAF50"
        
android:textSize="24sp"/>

    <TextView
        
android:text="Oswaldo"
        
android:layout_width="match_parent"
        
android:layout_height="wrap_content"
        
android:background="#4CAF50"
        
android:textSize="24sp"/>

    <TextView
        
android:text="Axel"
        
android:layout_width="wrap_content"
        
android:layout_height="50dp"
        
android:background="#4CAF50"
        
android:textSize="24sp"/>

    <TextView
        
android:text="Elian"
        
android:layout_width="wrap_content"
        
android:layout_height="wrap_content"
        
android:background="#4CAF50"
        
android:textSize="24sp"/>
</LinearLayout>

Código en Java
-
Resultados

Datos del alumno (nombre, grupo, especialidad y docente)
Fecha de realización
BRYAN ALEXIS NEGRETE CARRILLO
4°G
Programación
María Lourdes Ramírez Villaseñor
20/04/2018
(Día/mes/año)
Práctica no.
Nombre de la práctica
Parcial

2

Actividad 01: “Layouts en Android”: Proy02_Lista_de_invitados

1

2

X

3

Objetivo: (Describes de qué trata la actividad)
El estudiante realiza aplicaciones móviles que utilicen diferentes layouts, según lo vaya indicando el docente.
Código en XML

<LinearLayout
    
xmlns:android="http://schemas.android.com/apk/res/android"
    
android:orientation="vertical"
    
android:layout_width="match_parent"
    
android:layout_height="match_parent"
    
android:background="@android:color/darker_gray">

    <TextView
        
android:text="Lista de invitados"
        
android:layout_width="match_parent"
        
android:layout_height="wrap_content"
        
android:layout_weight="1"
        
android:background="#4CAF50"
        
android:textSize="24sp"/>

    <TextView
        
android:text="Oswaldo"
        
android:layout_width="match_parent"
        
android:layout_height="wrap_content"
        
android:layout_weight="1"
        
android:background="#537ED6"
        
android:textSize="24sp"/>

    <TextView
        
android:text="Axel"
        
android:layout_width="match_parent"
        
android:layout_height="wrap_content"
        
android:layout_weight="1"
        
android:background="#E2DEDE"
        
android:textSize="24sp"/>

    <TextView
        
android:text="Elian"
        
android:layout_width="match_parent"
        
android:layout_height="wrap_content"
        
android:background="#FFFFFF"
        
android:layout_weight="1"
        
android:textSize="24sp"/>
</LinearLayout>

Código en Java
-
Resultados


Datos del alumno (nombre, grupo, especialidad y docente)
Fecha de realización
BRYAN ALEXIS NEGRETE CARRILLO
4°G
Programación
María Lourdes Ramírez Villaseñor
20/04/2018
(Día/mes/año)
Práctica no.
Nombre de la práctica
Parcial

3

Actividad 01: “Layouts en Android”: Proy03_Insertar_imagen

1

2

X

3

Objetivo: (Describes de qué trata la actividad)
El estudiante realiza aplicaciones móviles que utilicen diferentes layouts, según lo vaya indicando el docente.
Código en XML

<LinearLayout
    
xmlns:android="http://schemas.android.com/apk/res/android"
    
xmlns:app="http://schemas.android.com/apk/res-auto"
    
android:orientation="vertical"
    
android:layout_width="match_parent"
    
android:layout_height="match_parent">

    <ImageView
        
android:src="@drawable/snake"
        
android:layout_width="wrap_content"
        
android:layout_height="wrap_content"
        
android:layout_weight="1"
        
android:scaleType="centerCrop"/>

    <TextView
        
android:text="I'm a snake"
        
android:layout_width="match_parent"
        
android:layout_height="wrap_content"
        
android:layout_weight="0"
        
android:textColor="@android:color/white"
        
android:textSize="54sp"
        
android:background="#023d37"/>
    <TextView
        
android:text="that goes for the forest"
        
android:layout_width="match_parent"
        
android:layout_height="wrap_content"
        
android:layout_weight="0"
        
android:textColor="@android:color/white"
        
android:textSize="34sp"
        
android:background="#023d37"/>
    <TextView
        
android:text="looking for a part of his cola"
        
android:layout_width="match_parent"
        
android:layout_height="wrap_content"
        
android:layout_weight="0"
        
android:textColor="@android:color/white"
        
android:textSize="18sp"
        
android:background="#023d37"/>
</LinearLayout>

Código en Java
-
Resultados


Datos del alumno (nombre, grupo, especialidad y docente)
Fecha de realización
BRYAN ALEXIS NEGRETE CARRILLO
4°G
Programación
María Lourdes Ramírez Villaseñor
20/04/2018
(Día/mes/año)
Práctica no.
Nombre de la práctica
Parcial

4

Actividad 01: “Layouts en Android”: Proy04_RelativeLayout

1

2

X

3

Objetivo: (Describes de qué trata la actividad)
El estudiante realiza aplicaciones móviles que utilicen diferentes layouts, según lo vaya indicando el docente.
Código en XML

<RelativeLayout
    
xmlns:android="http://schemas.android.com/apk/res/android"
    
android:layout_width="match_parent"
    
android:layout_height="match_parent"
    
android:padding="16dp">

    <TextView
        
android:text="I'm in this corner"
        
android:layout_width="wrap_content"
        
android:layout_height="wrap_content"
        
android:layout_alignParentBottom="true"
        
android:layout_alignParentLeft="true"/>

    <TextView
        
android:text="No, up here"
        
android:layout_width="wrap_content"
        
android:layout_height="wrap_content"
        
android:layout_alignParentTop="true"
        
android:layout_alignParentLeft="true"/>

    <TextView
        
android:text="Wait, i'm here"
        
android:layout_width="wrap_content"
        
android:layout_height="wrap_content"
        
android:layout_alignParentBottom="true"
        
android:layout_alignParentRight="true"/>

    <TextView
        
android:text="Actually, i'm here"
        
android:layout_width="wrap_content"
        
android:layout_height="wrap_content"
        
android:layout_alignParentTop="true"
        
android:layout_alignParentRight="true"/>
</RelativeLayout>

Código en Java
-
Resultados


Datos del alumno (nombre, grupo, especialidad y docente)
Fecha de realización
BRYAN ALEXIS NEGRETE CARRILLO
4°G
Programación
María Lourdes Ramírez Villaseñor
20/04/2018
(Día/mes/año)
Práctica no.
Nombre de la práctica
Parcial

5

Actividad 01: “Layouts en Android”: Proy05_RelativeLayout

1

2

X

3

Objetivo: (Describes de qué trata la actividad)
El estudiante realiza aplicaciones móviles que utilicen diferentes layouts, según lo vaya indicando el docente.
Código en XML

<RelativeLayout
    
xmlns:android="http://schemas.android.com/apk/res/android"
    
android:layout_width="match_parent"
    
android:layout_height="match_parent"
    
android:background="#ff5e00">

    <TextView
        
android:id="@+id/lyla_text_view"
        
android:layout_width="wrap_content"
        
android:layout_height="wrap_content"
        
android:layout_alignParentBottom="true"
        
android:layout_alignParentLeft="true"
        
android:textSize="24sp"
        
android:text="Lyla"/>

    <TextView
        
android:id="@+id/me_text_view"
        
android:layout_width="wrap_content"
        
android:layout_height="wrap_content"
        
android:layout_alignParentBottom="true"
        
android:layout_toRightOf="@id/lyla_text_view"
        
android:textSize="24sp"
        
android:text="Me"/>

    <TextView
        
android:id="@+id/natalie_text_view"
        
android:layout_width="wrap_content"
        
android:layout_height="wrap_content"
        
android:layout_above="@id/lyla_text_view"
        
android:textSize="24sp"
        
android:text="Natalie"/>

    <TextView
        
android:id="@+id/jennie_text_view"
        
android:layout_width="wrap_content"
        
android:layout_height="wrap_content"
        
android:layout_alignParentBottom="true"
        
android:layout_alignParentRight="true"
        
android:textSize="24sp"
        
android:text="Jennie"/>

    <TextView
        
android:id="@+id/amy_text_view"
        
android:layout_width="wrap_content"
        
android:layout_height="wrap_content"
        
android:layout_above="@id/omoju_text_view"
        
android:layout_alignParentRight="true"
        
android:textSize="24sp"
        
android:text="Amy"/>

    <TextView
        
android:id="@+id/omoju_text_view"
        
android:layout_width="wrap_content"
        
android:layout_height="wrap_content"
        
android:layout_alignParentRight="true"
        
android:layout_above="@id/jennie_text_view"
        
android:textSize="24sp"
        
android:text="Omoju"/>

    <TextView
        
android:id="@+id/kagure_text_view"
        
android:layout_width="wrap_content"
        
android:layout_height="wrap_content"
        
android:layout_toRightOf="@id/ben_text_view"
        
android:layout_alignParentTop="true"
        
android:textSize="24sp"
        
android:text="Kagure"/>

    <TextView
        
android:id="@+id/ben_text_view"
        
android:layout_width="wrap_content"
        
android:layout_height="wrap_content"
        
android:layout_centerHorizontal="true"
        
android:layout_alignParentTop="true"
        
android:textSize="24sp"
        
android:text="Ben"/>
    <TextView
        
android:id="@+id/Kunal_text_view"
        
android:layout_width="wrap_content"
        
android:layout_height="wrap_content"
        
android:layout_toLeftOf="@id/ben_text_view"
        
android:layout_alignParentTop="true"
        
android:textSize="24sp"
        
android:text="Kunal"/>
</RelativeLayout>
Código en Java
-
Resultados



Datos del alumno (nombre, grupo, especialidad y docente)
Fecha de realización
BRYAN ALEXIS NEGRETE CARRILLO
4°G
Programación
María Lourdes Ramírez Villaseñor
20/04/2018
(Día/mes/año)
Práctica no.
Nombre de la práctica
Parcial

6

Actividad 01: “Layouts en Android”: Proy06_RelativeLayout

1

2

X

3

Objetivo: (Describes de qué trata la actividad)
El estudiante realiza aplicaciones móviles que utilicen diferentes layouts, según lo vaya indicando el docente.
Código en XML

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    
xmlns:android="http://schemas.android.com/apk/res/android"
    
android:layout_width="match_parent"
    
android:layout_height="match_parent"
    
android:orientation="vertical">

    <ImageView
        
android:layout_margin="10sp"
        
android:layout_width="wrap_content"
        
android:layout_height="wrap_content"
        
android:layout_weight="1"
        
android:scaleType="centerCrop"
        
android:src="@drawable/snake"/>

    <TextView
        
android:layout_marginLeft="10sp"
        
android:layout_marginRight="10sp"
        
android:text="Playa Plebe"
        
android:layout_width="match_parent"
        
android:layout_height="wrap_content"
        
android:layout_weight=""
        
android:textSize="44sp"
        
android:textColor="@android:color/white"
        
android:background="#009688"/>

    <TextView
        
android:layout_marginLeft="10sp"
        
android:layout_marginRight="10sp"
        
android:layout_width="match_parent"
        
android:layout_height="wrap_content"
        
android:text="California"
        
android:layout_weight=""
        
android:textSize="34sp"
        
android:textColor="@android:color/white"
        
android:background="#009688"/>

    <TextView
        
android:layout_marginLeft="10sp"
        
android:layout_marginRight="10sp"
        
android:layout_marginBottom="10sp"
        
android:layout_width="match_parent"
        
android:layout_height="wrap_content"
        
android:text="10 miles away"
        
android:layout_weight=""
        
android:textSize="18sp"
        
android:textColor="@android:color/white"
        
android:background="#009688"/>
</LinearLayout>
Código en Java
-
Resultados




Datos del alumno (nombre, grupo, especialidad y docente)
Fecha de realización
BRYAN ALEXIS NEGRETE CARRILLO
4°G
Programación
María Lourdes Ramírez Villaseñor
20/04/2018
(Día/mes/año)
Práctica no.
Nombre de la práctica
Parcial

7

Actividad 02: “ScrollViews en Android”

1

2

X

3

Objetivo: (Describes de qué trata la actividad)
Que el estudiante se familiarice con el uso del ScrollView que maneja Android, realizando una serie de aplicaciones que los utilicen.
Código en XML

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    
xmlns:android="http://schemas.android.com/apk/res/android"
    
android:orientation="vertical"
    
android:layout_width="match_parent"
    
android:layout_height="match_parent">


    <HorizontalScrollView
        
android:layout_width="match_parent"
        
android:layout_height="match_parent"
        
android:layout_weight="1">

        <LinearLayout
            
android:layout_width="wrap_content"
            
android:layout_height="match_parent"
            
android:orientation="horizontal" >

            <Button
                
android:id="@+id/button"
                
android:layout_width="wrap_content"
                
android:layout_height="match_parent"
                
android:layout_weight="1"
                
android:text="Button" />

            <Button
                
android:id="@+id/button11"
                
android:layout_width="wrap_content"
                
android:layout_height="match_parent"
                
android:layout_weight="1"
                
android:text="Button" />

            <Button
                
android:id="@+id/button10"
                
android:layout_width="wrap_content"
                
android:layout_height="match_parent"
                
android:layout_weight="1"
                
android:text="Button" />

            <Button
                
android:id="@+id/button9"
                
android:layout_width="wrap_content"
                
android:layout_height="match_parent"
                
android:layout_weight="1"
                
android:text="Button" />

            <Button
                
android:id="@+id/button8"
                
android:layout_width="wrap_content"
                
android:layout_height="match_parent"
                
android:layout_weight="1"
                
android:text="Button" />

            <Button
                
android:id="@+id/button7"
                
android:layout_width="wrap_content"
                
android:layout_height="match_parent"
                
android:layout_weight="1"
                
android:text="Button" />

            <Button
                
android:id="@+id/button6"
                
android:layout_width="wrap_content"
                
android:layout_height="match_parent"
                
android:layout_weight="1"
                
android:text="Button" />

            <Button
                
android:id="@+id/button5"
                
android:layout_width="wrap_content"
                
android:layout_height="match_parent"
                
android:layout_weight="1"
                
android:text="Button" />

            <Button
                
android:id="@+id/button4"
                
android:layout_width="wrap_content"
                
android:layout_height="match_parent"
                
android:layout_weight="1"
                
android:text="Button" />

            <Button
                
android:id="@+id/button3"
                
android:layout_width="wrap_content"
                
android:layout_height="match_parent"
                
android:layout_weight="1"
                
android:text="Button" />
        </LinearLayout>
    </HorizontalScrollView>

    <ScrollView
        
android:layout_width="match_parent"
        
android:layout_height="match_parent"
        
android:layout_weight="1">

        <LinearLayout
            
android:layout_width="match_parent"
            
android:layout_height="wrap_content"
            
android:orientation="vertical" >

            <Button
                
android:id="@+id/button2"
                
android:layout_width="match_parent"
                
android:layout_height="wrap_content"
                
android:text="Button" />

            <Button
                
android:id="@+id/button20"
                
android:layout_width="match_parent"
                
android:layout_height="wrap_content"
                
android:text="Button" />

            <Button
                
android:id="@+id/button19"
                
android:layout_width="match_parent"
                
android:layout_height="wrap_content"
                
android:text="Button" />

            <Button
                
android:id="@+id/button18"
                
android:layout_width="match_parent"
                
android:layout_height="wrap_content"
                
android:text="Button" />

            <Button
                
android:id="@+id/button17"
                
android:layout_width="match_parent"
                
android:layout_height="wrap_content"
                
android:text="Button" />

            <Button
                
android:id="@+id/button16"
                
android:layout_width="match_parent"
                
android:layout_height="wrap_content"
                
android:text="Button" />

            <Button
                
android:id="@+id/button15"
                
android:layout_width="match_parent"
                
android:layout_height="wrap_content"
                
android:text="Button" />

            <Button
                
android:id="@+id/button14"
                
android:layout_width="match_parent"
                
android:layout_height="wrap_content"
                
android:text="Button" />

            <Button
                
android:id="@+id/button13"
                
android:layout_width="match_parent"
                
android:layout_height="wrap_content"
                
android:text="Button" />

            <Button
                
android:id="@+id/button12"
                
android:layout_width="match_parent"
                
android:layout_height="wrap_content"
                
android:text="Button" />
        </LinearLayout>
    </ScrollView>

</LinearLayout>
Código en Java
-
Resultados


Datos del alumno (nombre, grupo, especialidad y docente)
Fecha de realización
BRYAN ALEXIS NEGRETE CARRILLO
4°G
Programación
María Lourdes Ramírez Villaseñor
20/04/2018
(Día/mes/año)
Práctica no.
Nombre de la práctica
Parcial

8

Actividad 03: “ConstraintLayout en Android”

1

2

X

3

Objetivo: (Describes de qué trata la actividad)
Que el estudiante se familiarice con el uso del ConstraintLayout que maneja Android, realizando una serie de aplicaciones que los utilicen.
Código en XML

 <?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/holo_blue_bright">
  
    <ImageView
        android:id="@+id/imageView2"
        android:layout_width="108dp"
        android:layout_height="127dp"
        android:layout_marginStart="16dp"
        android:layout_marginTop="16dp"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:srcCompat="@drawable/dgeti" />

  

    <TextView

        android:id="@+id/textView"

        android:layout_width="wrap_content"

        android:layout_height="42dp"

        android:layout_marginEnd="8dp"

        android:layout_marginStart="8dp"

        android:layout_marginTop="52dp"

        android:text="¡Bienvenido!"

        android:textSize="30sp"

        app:layout_constraintEnd_toEndOf="parent"

        app:layout_constraintHorizontal_bias="0.311"

        app:layout_constraintStart_toEndOf="@+id/imageView2"

        app:layout_constraintTop_toTopOf="parent" />

  

    <TextView

        android:id="@+id/textView2"

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:layout_marginEnd="8dp"

        android:layout_marginStart="8dp"

        android:layout_marginTop="60dp"

        android:text="Bienvenido a la programación con Android,"

        android:textSize="18sp"

        app:layout_constraintEnd_toEndOf="parent"

        app:layout_constraintHorizontal_bias="0.491"

        app:layout_constraintStart_toStartOf="parent"

        app:layout_constraintTop_toBottomOf="@+id/textView" />

  

    <TextView

        android:id="@+id/textView3"

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:layout_marginEnd="8dp"

        android:layout_marginStart="8dp"

        android:text="estudiante de bachillerato,"

        android:textSize="18sp"

        app:layout_constraintEnd_toEndOf="parent"

        app:layout_constraintHorizontal_bias="0.497"

        app:layout_constraintStart_toStartOf="parent"

        app:layout_constraintTop_toBottomOf="@+id/textView2" />

  

    <TextView

        android:id="@+id/textView4"

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:layout_marginEnd="8dp"

        android:layout_marginStart="8dp"

        android:text="un mundo fantástico te espera"

        android:textSize="18sp"

        app:layout_constraintEnd_toEndOf="parent"

        app:layout_constraintHorizontal_bias="0.496"

        app:layout_constraintStart_toStartOf="parent"

        app:layout_constraintTop_toBottomOf="@+id/textView3" />

  

    <TextView

        android:id="@+id/textView5"

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:layout_marginEnd="8dp"

        android:layout_marginStart="8dp"

        android:text="con Android"

        android:textSize="18sp"

        app:layout_constraintEnd_toEndOf="parent"

        app:layout_constraintStart_toStartOf="parent"

        app:layout_constraintTop_toBottomOf="@+id/textView4" />

  

    <TextView

        android:id="@+id/textView6"

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:layout_marginEnd="8dp"

        android:layout_marginStart="8dp"

        android:text="¿Estás preparado?"

        android:textSize="18sp"

        app:layout_constraintEnd_toEndOf="parent"

        app:layout_constraintHorizontal_bias="0.497"

        app:layout_constraintStart_toStartOf="parent"

        app:layout_constraintTop_toBottomOf="@+id/textView5" />

  

    <TextView

        android:id="@+id/textView7"

        android:layout_width="wrap_content"

        android:layout_height="32dp"

        android:layout_marginBottom="28dp"

        android:layout_marginStart="44dp"

        android:text="No te arrepentirás"

        android:textSize="18sp"

        app:layout_constraintBottom_toBottomOf="parent"

        app:layout_constraintStart_toStartOf="parent" />

  

    <Button

        android:id="@+id/button2"

        android:layout_width="73dp"

        android:layout_height="44dp"

        android:layout_marginBottom="16dp"

        android:layout_marginEnd="16dp"

        android:text="Salir"

        app:layout_constraintBottom_toBottomOf="parent"

        app:layout_constraintEnd_toEndOf="parent" />

  

    <ToggleButton

        android:id="@+id/toggleButton"

        android:layout_width="96dp"

        android:layout_height="wrap_content"

        android:layout_marginBottom="8dp"

        android:layout_marginEnd="8dp"

        android:layout_marginStart="8dp"

        android:layout_marginTop="8dp"

        android:text="ToggleButton"

        app:layout_constraintBottom_toTopOf="@+id/textView7"

        app:layout_constraintEnd_toEndOf="parent"

        app:layout_constraintHorizontal_bias="0.499"

        app:layout_constraintStart_toStartOf="parent"

        app:layout_constraintTop_toBottomOf="@+id/textView6"

        app:layout_constraintVertical_bias="0.0" />

</android.support.constraint.ConstraintLayout>

Código en Java
-
Resultados



Datos del alumno (nombre, grupo, especialidad y docente)
Fecha de realización
BRYAN ALEXIS NEGRETE CARRILLO
4°G
Programación
María Lourdes Ramírez Villaseñor
20/04/2018
(Día/mes/año)
Práctica no.
Nombre de la práctica
Parcial

9

Actividad 04: “Calculadora”

1

2

X

3

Objetivo: (Describes de qué trata la actividad)
Que el estudiante se familiarice con el uso del ConstraintLayout que maneja Android, realizando una serie de aplicaciones que los utilicen.
Código en XML

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".MainActivity">
  
    <LinearLayout

        android:layout_width="match_parent"

        android:layout_height="wrap_content"

        android:orientation="horizontal">

  

        <EditText

            android:id="@+id/no1"

            android:layout_width="match_parent"

            android:layout_height="wrap_content"

            android:layout_weight="1"

            android:hint="Número 1"

            android:inputType="numberDecimal"

            android:textSize="20sp" />

  

        <EditText

            android:id="@+id/no2"

            android:layout_width="match_parent"

            android:layout_height="wrap_content"

            android:layout_weight="1"

            android:hint="Número 2"

            android:inputType="numberDecimal"

            android:textSize="20sp" />

    </LinearLayout>

  

    <LinearLayout

        android:layout_width="match_parent"

        android:layout_height="wrap_content"

        android:orientation="horizontal">

  

        <Button

            android:id="@+id/sum"

            android:layout_width="wrap_content"

            android:layout_height="wrap_content"

            android:layout_weight="1"

            android:text="+"

            android:textSize="50sp" />

  

        <Button

            android:id="@+id/res"

            android:layout_width="wrap_content"

            android:layout_height="wrap_content"

            android:layout_weight="1"

            android:text="-"

            android:textSize="50sp" />

  

        <Button

            android:id="@+id/mul"

            android:layout_width="wrap_content"

            android:layout_height="wrap_content"

            android:layout_weight="1"

            android:text="*"

            android:textSize="50sp" />

  

        <Button

            android:id="@+id/div"

            android:layout_width="wrap_content"

            android:layout_height="wrap_content"

            android:layout_weight="1"

            android:text="/"

            android:textSize="50sp" />

  

    </LinearLayout>

  

    <TextView

        android:id="@+id/resul"

        android:layout_width="match_parent"

        android:layout_height="wrap_content"

        android:layout_weight="1"

        android:text="0.0"

        android:gravity="center"

        android:textSize="150sp" />

  

</LinearLayout>
 
Código en Java
package com.deltoro.leonardo.act04_calculadora;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import java.text.DecimalFormat;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {

  

    EditText no1,no2;

    Button sum,res,mul,div;

    TextView resul;

  

    @Override

    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_main);

  

        no1 = (EditText) findViewById(R.id.no1);

        no2 = (EditText) findViewById(R.id.no2);

  

        sum = (Button) findViewById(R.id.sum);

        res = (Button) findViewById(R.id.res);

        mul = (Button) findViewById(R.id.mul);

        div = (Button) findViewById(R.id.div);

  

        no2.setEnabled(false);

        sum.setEnabled(false);

        res.setEnabled(false);

        mul.setEnabled(false);

        div.setEnabled(false);

  

        no1.addTextChangedListener(new TextWatcher() {

            @Override

            public void beforeTextChanged(CharSequence s, int start, int count, int after) {

  

            }

  

            @Override

            public void onTextChanged(CharSequence s, int start, int before, int count) {

                if (s.toString().equals("")){

                    no2.setEnabled(false);

                } else no2.setEnabled(true);

            }

  

            @Override

            public void afterTextChanged(Editable s) {

  

            }

        });

  

        no2.addTextChangedListener(new TextWatcher() {

            @Override

            public void beforeTextChanged(CharSequence s, int start, int count, int after) {

  

            }

  

            @Override

            public void onTextChanged(CharSequence s, int start, int before, int count) {

                if (s.toString().equals("")){

                    sum.setEnabled(false);

                    res.setEnabled(false);

                    mul.setEnabled(false);

                    div.setEnabled(false);

                } else {

                    sum.setEnabled(true);

                    res.setEnabled(true);

                    mul.setEnabled(true);

                    div.setEnabled(true);

                }

            }

  

            @Override

            public void afterTextChanged(Editable s) {

  

            }

        });

  

        resul = (TextView) findViewById(R.id.resul);

  

        sum.setOnClickListener(this);

        res.setOnClickListener(this);

        mul.setOnClickListener(this);

        div.setOnClickListener(this);

    }

  

    private static DecimalFormat df2 = new DecimalFormat(".##");

  

    @Override

    public void onClick(View v) {

  

        String n1 = no1.getText().toString();

        String n2 = no2.getText().toString();

  

        double ent1 = Double.parseDouble(n1);

        double ent2 = Double.parseDouble(n2);

  

        double rta =  0;

  

        switch (v.getId()){

            case R.id.sum:

                rta = ent1+ent2;

                break;

            case R.id.res:

                rta = ent1-ent2;

                break;

            case R.id.mul:

                rta = ent1*ent2;

                break;

            case R.id.div:

                rta = ent1/ent2;

                break;

        }

  

        resul.setText(""+df2.format(rta));

    }

}

Resultados



Datos del alumno (nombre, grupo, especialidad y docente)
Fecha de realización
BRYAN ALEXIS NEGRETE CARRILLO
4°G
Programación
María Lourdes Ramírez Villaseñor
20/04/2018
(Día/mes/año)
Práctica no.
Nombre de la práctica
Parcial

10

Actividad 05: “Par - impar”

1

2

X

3

Objetivo: (Describes de qué trata la actividad)
Que el estudiante se familiarice con el uso de las sentencias de selección, realizando una serie de aplicaciones que las utilicen.
Código en XML
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    
xmlns:android="http://schemas.android.com/apk/res/android"
    
xmlns:tools="http://schemas.android.com/tools"
    
android:layout_width="match_parent"
    
android:layout_height="match_parent"
    
android:orientation="vertical"
    
tools:context=".MainActivity">


    <Space
        
android:layout_width="match_parent"
        
android:layout_height="wrap_content"
        
android:layout_weight="1" />

    <EditText
        
android:id="@+id/num"
        
android:layout_width="match_parent"
        
android:layout_height="wrap_content"
        
android:hint="Escriba un número"
        
android:textSize="40sp"
        
android:textAlignment="center"
        
android:layout_weight="1"
        
android:inputType="number"/>

    <Space
        
android:layout_width="match_parent"
        
android:layout_height="wrap_content"
        
android:layout_weight="1" />

    <Button
        
android:id="@+id/btn"
        
android:layout_width="match_parent"
        
android:layout_height="wrap_content"
        
android:text="Mostrar"
        
android:layout_weight="1" />

    <Space
        
android:layout_width="match_parent"
        
android:layout_height="wrap_content"
        
android:layout_weight="1" />

    <TextView
        
android:id="@+id/txt"
        
android:layout_width="match_parent"
        
android:layout_height="wrap_content"
        
android:layout_weight="1"
        
android:textAlignment="center"
        
android:textSize="30sp"
        
android:text="Es un número:" />

    <TextView
        
android:id="@+id/resul"
        
android:layout_width="match_parent"
        
android:layout_height="wrap_content"
        
android:text="..."
        
android:layout_weight="3"
        
android:textSize="70sp"
        
android:textAlignment="center" />
</LinearLayout>
 
Código en Java
package com.deltoro.leonardo.act05_par_impar;

import 
android.support.v7.app.AppCompatActivity;
import 
android.os.Bundle;
import 
android.text.Editable;
import 
android.text.TextWatcher;
import 
android.view.View;
import 
android.widget.Button;
import 
android.widget.EditText;
import 
android.widget.TextView;

public class 
MainActivity extends AppCompatActivity implements View.OnClickListener {

    EditText 
num;
    
Button btn;
    
TextView resul;

    
@Override
    
protected void onCreate(Bundle savedInstanceState) {
        
super.onCreate(savedInstanceState);
        
setContentView(R.layout.activity_main);

        
num = (EditText)findViewById(R.id.num);
        
btn = (Button)findViewById(R.id.btn);

        
btn.setEnabled(false);

        
num.addTextChangedListener(new TextWatcher() {
            
@Override
            
public void beforeTextChanged(CharSequence s, int start, int count, int after) {

            }

            
@Override
            
public void onTextChanged(CharSequence s, int start, int before, int count) {
                
if (s.toString().equals("")){
                    
btn.setEnabled(false);
                
else btn.setEnabled(true);
            
}

            
@Override
            
public void afterTextChanged(Editable s) {

            }
        })
;

        
resul= (TextView)findViewById(R.id.resul);

        
btn.setOnClickListener(this);
        
}

    
@Override
    
public void onClick(View v) {

        String r
;
        int 
n = Integer.parseInt(num.getText().toString());

        if 
(n % == 0)
            r = 
"Par";
        else
            
r = "Impar";

        
resul.setText(r);
    
}
}
 
Resultados



Datos del alumno (nombre, grupo, especialidad y docente)
Fecha de realización
BRYAN ALEXIS NEGRETE CARRILLO
4°G
Programación
María Lourdes Ramírez Villaseñor
20/04/2018
(Día/mes/año)
Práctica no.
Nombre de la práctica
Parcial

11

Actividad 06: “RadioButton”

1

2

X

3

Objetivo: (Describes de qué trata la actividad)
Que el estudiante se familiarice con el uso del RadioButton, realizando una serie de aplicaciones que las utilicen.
Código en XML
 <?xml version="1.0" encoding="utf-8"?>

<LinearLayout

    xmlns:android="http://schemas.android.com/apk/res/android"

    xmlns:tools="http://schemas.android.com/tools"

    android:layout_width="match_parent"

    android:layout_height="match_parent"

    android:orientation="vertical">

  

    <LinearLayout

        android:layout_width="match_parent"

        android:layout_height="wrap_content"

        android:orientation="horizontal">

  

        <EditText

            android:id="@+id/no1"

            android:layout_width="match_parent"

            android:layout_height="wrap_content"

            android:layout_weight="1"

            android:hint="Número 1"

            android:inputType="numberDecimal"

            android:textSize="20sp" />

  

        <EditText

            android:id="@+id/no2"

            android:layout_width="match_parent"

            android:layout_height="wrap_content"

            android:layout_weight="1"

            android:hint="Número 2"

            android:inputType="numberDecimal"

            android:textSize="20sp" />

    </LinearLayout>

  

    <LinearLayout

        android:layout_width="match_parent"

        android:layout_height="wrap_content"

        android:orientation="horizontal">

  

        <RadioGroup

            android:id="@+id/group"

            android:layout_width="match_parent"

            android:layout_height="match_parent"

            android:layout_weight="1" >

  

            <RadioButton

                android:id="@+id/sum"

                android:layout_width="wrap_content"

                android:layout_height="wrap_content"

                android:layout_weight="1"

                android:text="Suma"

                android:onClick="rbclick"

                android:checked="false"

                android:textSize="20sp" />

  

            <RadioButton

                android:id="@+id/res"

                android:layout_width="wrap_content"

                android:layout_height="wrap_content"

                android:layout_weight="1"

                android:text="Resta"

                android:onClick="rbclick"

                android:checked="false"

                android:textSize="20sp" />

  

            <RadioButton

                android:id="@+id/mul"

                android:layout_width="wrap_content"

                android:layout_height="wrap_content"

                android:layout_weight="1"

                android:text="Multiplicación"

                android:onClick="rbclick"

                android:checked="false"

                android:textSize="20sp" />

  

            <RadioButton

                android:id="@+id/div"

                android:layout_width="wrap_content"

                android:layout_height="wrap_content"

                android:layout_weight="1"

                android:text="División"

                android:onClick="rbclick"

                android:checked="false"

                android:textSize="20sp" />

        </RadioGroup>

  

    </LinearLayout>

  

    <TextView

        android:id="@+id/resul"

        android:layout_width="match_parent"

        android:layout_height="wrap_content"

        android:layout_weight="1"

        android:text="0.0"

        android:gravity="center"

        android:textSize="150sp" />

  

</LinearLayout>

Código en Java
package com.deltoro.leonardo.act06_radiobutton;

import 
android.support.v7.app.AppCompatActivity;
import 
android.os.Bundle;
import 
android.text.Editable;
import 
android.text.TextWatcher;
import 
android.view.View;
import 
android.widget.EditText;
import 
android.widget.RadioButton;
import 
android.widget.RadioGroup;
import 
android.widget.TextView;
import 
android.widget.Toast;

import 
java.text.DecimalFormat;

public class 
MainActivity extends AppCompatActivity {

    RadioGroup 
rg;
    
EditText no1,no2;
    
RadioButton rb;
    
TextView resul;

    
@Override
    
protected void onCreate(Bundle savedInstanceState) {
        
super.onCreate(savedInstanceState);
        
setContentView(R.layout.activity_main);

        
rg = (RadioGroup) findViewById(R.id.group);

        
no1 = (EditText) findViewById(R.id.no1);
        
no2 = (EditText) findViewById(R.id.no2);

        
resul = (TextView) findViewById(R.id.resul);

        
no2.setEnabled(false);
        
rg.setVisibility(View.INVISIBLE);

        
no1.addTextChangedListener(new TextWatcher() {
            
@Override
            
public void beforeTextChanged(CharSequence s, int start, int count, int after) {

            }

            
@Override
            
public void onTextChanged(CharSequence s, int start, int before, int count) {
                
if (s.toString().equals("")){
                    
no2.setEnabled(false);
                
else no2.setEnabled(true);
            
}

            
@Override
            
public void afterTextChanged(Editable s) {

            }
        })
;

        
no2.addTextChangedListener(new TextWatcher() {
            
@Override
            
public void beforeTextChanged(CharSequence s, int start, int count, int after) {

            }

            
@Override
            
public void onTextChanged(CharSequence s, int start, int before, int count) {
                
if (s.toString().equals("")){
                    
rg.setVisibility(View.INVISIBLE);
                
else {
                    
rg.setVisibility(View.VISIBLE);
                
}
            }

            
@Override
            
public void afterTextChanged(Editable s) {

            }
        })
;
    
}

    
public void rbclick (View v) {
        
int radiobuttonid = rg.getCheckedRadioButtonId();
        
rb = (RadioButton) findViewById(radiobuttonid);

        
String n1 = no1.getText().toString();
        
String n2 = no2.getText().toString();

        double 
ent1 = Double.parseDouble(n1);
        double 
ent2 = Double.parseDouble(n2);

        double 
rta =  0;

        switch 
(v.getId()){
            
case R.id.sum:
                rta = ent1+ent2
;
                break;
            case 
R.id.res:
                rta = ent1-ent2
;
                break;
            case 
R.id.mul:
                rta = ent1*ent2
;
                break;
            case 
R.id.div:
                rta = ent1/ent2
;
                break;
        
}

        
resul.setText(""+df2.format(rta));
    
}

    
private static DecimalFormat df2 new DecimalFormat(".##");}

Resultados




Datos del alumno (nombre, grupo, especialidad y docente)
Fecha de realización
BRYAN ALEXIS NEGRETE CARRILLO
4°G
Programación
María Lourdes Ramírez Villaseñor
20/04/2018
(Día/mes/año)
Práctica no.
Nombre de la práctica
Parcial

12

Actividad 07: “CheckBox”

1

2

X

3

Objetivo: (Describes de qué trata la actividad)
Que el estudiante se familiarice con el uso de las casillas de verificación (CheckBox) que maneja Android, realizando una serie de aplicaciones que los utilicen.
Código en XML
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    
xmlns:android="http://schemas.android.com/apk/res/android"
    
android:layout_width="match_parent"
    
android:layout_height="match_parent"
    
android:orientation="vertical">

    <LinearLayout
        
android:layout_width="match_parent"
        
android:layout_height="wrap_content"
        
android:orientation="horizontal">

        <EditText
            
android:id="@+id/no1"
            
android:layout_width="match_parent"
            
android:layout_height="wrap_content"
            
android:layout_weight="1"
            
android:hint="Número 1"
            
android:inputType="numberDecimal"
            
android:textSize="20sp" />

        <EditText
            
android:id="@+id/no2"
            
android:layout_width="match_parent"
            
android:layout_height="wrap_content"
            
android:layout_weight="1"
            
android:hint="Número 2"
            
android:inputType="numberDecimal"
            
android:textSize="20sp" />
    </LinearLayout>

    <LinearLayout
        
android:layout_width="match_parent"
        
android:layout_height="wrap_content"
        
android:orientation="vertical">

        <CheckBox
            
android:id="@+id/sum"
            
android:layout_width="match_parent"
            
android:layout_height="wrap_content"
            
android:onClick="checkone"
            
android:layout_weight="1"
            
android:textSize="20sp"
            
android:text="Suma" />

        <CheckBox
            
android:id="@+id/res"
            
android:layout_width="match_parent"
            
android:layout_height="wrap_content"
            
android:onClick="checkone"
            
android:layout_weight="1"
            
android:textSize="20sp"
            
android:text="Resta" />

        <CheckBox
            
android:id="@+id/mul"
            
android:layout_width="match_parent"
            
android:layout_height="wrap_content"
            
android:onClick="checkone"
            
android:layout_weight="1"
            
android:textSize="20sp"
            
android:text="Multiplicación" />

        <CheckBox
            
android:id="@+id/div"
            
android:layout_width="match_parent"
            
android:layout_height="wrap_content"
            
android:onClick="checkone"
            
android:layout_weight="1"
            
android:textSize="20sp"
            
android:text="División" />

    </LinearLayout>

    <TextView
        
android:id="@+id/resul"
        
android:layout_width="match_parent"
        
android:layout_height="wrap_content"
        
android:layout_weight="1"
        
android:text="0.0"
        
android:gravity="center"
        
android:textSize="150sp" />

</LinearLayout>
 

Código en Java
package com.deltoro.leonardo.act07_checkbox;

import 
android.support.v7.app.AppCompatActivity;
import 
android.os.Bundle;
import 
android.text.Editable;
import 
android.text.TextWatcher;
import 
android.view.View;
import 
android.widget.CheckBox;
import 
android.widget.EditText;
import 
android.widget.TextView;

import 
java.text.DecimalFormat;

public class 
MainActivity extends AppCompatActivity {

    EditText 
no1,no2;
    
CheckBox cb1,cb2,cb3,cb4;
    
TextView resul;

    
@Override
    
protected void onCreate(Bundle savedInstanceState) {
        
super.onCreate(savedInstanceState);
        
setContentView(R.layout.activity_main);

        
no1 = (EditText) findViewById(R.id.no1);
        
no2 = (EditText) findViewById(R.id.no2);
        
cb1 = (CheckBox) findViewById(R.id.sum);
        
cb2 = (CheckBox) findViewById(R.id.res);
        
cb3 = (CheckBox) findViewById(R.id.mul);
        
cb4 = (CheckBox) findViewById(R.id.div);
        
resul = (TextView) findViewById(R.id.resul);

        
no2.setEnabled(false);
        
cb1.setEnabled(false);
        
cb2.setEnabled(false);
        
cb3.setEnabled(false);
        
cb4.setEnabled(false);

        
no1.addTextChangedListener(new TextWatcher() {
            
@Override
            
public void beforeTextChanged(CharSequence s, int start, int count, int after) {

            }

            
@Override
            
public void onTextChanged(CharSequence s, int start, int before, int count) {
                
if (s.toString().equals("")){
                    
no2.setEnabled(false);
                
else no2.setEnabled(true);
            
}

            
@Override
            
public void afterTextChanged(Editable s) {

            }
        })
;

        
no2.addTextChangedListener(new TextWatcher() {
            
@Override
            
public void beforeTextChanged(CharSequence s, int start, int count, int after) {

            }

            
@Override
            
public void onTextChanged(CharSequence s, int start, int before, int count) {
                
if (s.toString().equals("")){
                    
cb1.setEnabled(false);
                    
cb2.setEnabled(false);
                    
cb3.setEnabled(false);
                    
cb4.setEnabled(false);
                
else {
                    
cb1.setEnabled(true);
                    
cb2.setEnabled(true);
                    
cb3.setEnabled(true);
                    
cb4.setEnabled(true);
                
}
            }

            
@Override
            
public void afterTextChanged(Editable s) {

            }
        })
;
    
}

    
private static DecimalFormat df2 new DecimalFormat(".##");

    public void 
checkone (View v) {

        String n1 = 
no1.getText().toString();
        
String n2 = no2.getText().toString();

        double 
ent1 = Double.parseDouble(n1);
        double 
ent2 = Double.parseDouble(n2);
        double 
rta =  0;

        if 
(cb1.isChecked() == true){
            rta=ent1+ent2
;
            
resul.setText(""+df2.format(rta));
            
cb2.setEnabled(false);
            
cb3.setEnabled(false);
            
cb4.setEnabled(false);
        
else {
            
cb2.setEnabled(true);
            
cb3.setEnabled(true);
            
cb4.setEnabled(true);
            if 
(cb2.isChecked() == true){
                rta=ent1-ent2
;
                
resul.setText(""+df2.format(rta));
                
cb1.setEnabled(false);
                
cb3.setEnabled(false);
                
cb4.setEnabled(false);
            
else {
                
cb1.setEnabled(true);
                
cb3.setEnabled(true);
                
cb4.setEnabled(true);
                if 
(cb3.isChecked() == true){
                    rta=ent1*ent2
;
                    
resul.setText(""+df2.format(rta));
                    
cb1.setEnabled(false);
                    
cb2.setEnabled(false);
                    
cb4.setEnabled(false);
                
else {
                    
cb1.setEnabled(true);
                    
cb2.setEnabled(true);
                    
cb4.setEnabled(true);
                    if 
(cb4.isChecked() == true){
                        rta=ent1/ent2
;
                        
resul.setText(""+df2.format(rta));
                        
cb1.setEnabled(false);
                        
cb2.setEnabled(false);
                        
cb3.setEnabled(false);
                    
else {
                        
cb1.setEnabled(true);
                        
cb2.setEnabled(true);
                        
cb3.setEnabled(true);
                    
}
                }
            }
        }
    }
}



Resultados

Comentarios