Skip to content
Snippets Groups Projects
Commit 3073c4c1 authored by Sofiane Lasri's avatar Sofiane Lasri
Browse files

Partie 4: Plusieurs activités

parent 545129ff
Branches
No related tags found
No related merge requests found
Pipeline #4 failed
......@@ -3,6 +3,9 @@
<component name="DesignSurface">
<option name="filePathToZoomLevelMap">
<map>
<entry key="..\:/Git/application-android-iut/app/src/main/res/layout-land/activity_main.xml" value="0.1" />
<entry key="..\:/Git/application-android-iut/app/src/main/res/layout/activity_main.xml" value="0.10960144927536232" />
<entry key="..\:/Git/application-android-iut/app/src/main/res/layout/activity_num_table.xml" value="0.264" />
<entry key="..\:/Z IUT Orsay/AndroidStudioProjects/Pizzeria/app/src/main/res/layout-land/activity_main.xml" value="0.1" />
<entry key="..\:/Z IUT Orsay/AndroidStudioProjects/Pizzeria/app/src/main/res/layout/activity_main.xml" value="0.2" />
</map>
......
......@@ -10,7 +10,7 @@
android:supportsRtl="true"
android:theme="@style/Theme.Pizzeria" >
<activity
android:name=".MainActivity"
android:name=".NumTable"
android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
......@@ -18,6 +18,9 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:exported="true" />
</application>
</manifest>
\ No newline at end of file
package com.slprojects.pizzeria;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class NumTable extends AppCompatActivity implements View.OnClickListener {
private EditText input;
private Button btn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_num_table);
input = findViewById(R.id.tableNumInput);
btn = findViewById(R.id.btnValider);
btn.setOnClickListener(this);
}
@Override
public void onClick(View v){
if(v.getId() == btn.getId()) {
Log.i("Numéro de la table", input.getText().toString());
}
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".NumTable">
<TextView
android:id="@+id/textNumTable"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:text="Numéro de table"
android:textSize="16sp"
app:layout_constraintBottom_toTopOf="@+id/btnValider"
app:layout_constraintEnd_toStartOf="@+id/tableNumInput"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="@+id/tableNumInput"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="32dp"
android:ems="10"
android:inputType="number"
app:layout_constraintBottom_toTopOf="@+id/btnValider"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/textNumTable"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/btnValider"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tableNumInput" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment