Skip to content
Snippets Groups Projects
Commit 99b0a986 authored by Paul Cancel's avatar Paul Cancel
Browse files

Q3 : Ajout du bouton quitter

parent 905311e6
No related branches found
No related tags found
No related merge requests found
......@@ -2,13 +2,31 @@ package fr.iutlille.ctp2024;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class MainActivity extends AppCompatActivity {
public class MainActivity extends AppCompatActivity implements View.OnClickListener{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.super_tache);
setTitle("Super Tâches");
Button btn = (Button) findViewById(R.id.button2);
btn.setOnClickListener(this);
}
@Override
public void onClick(View btn) {
Intent intent;
if(btn.getId() == R.id.button2){
intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_HOME);
startActivity(intent);
}
}
}
\ 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