Articles

Affichage des articles associés au libellé Listener

Tutoriel Android :utilisation des boutons et des Toasts

Image
Dans ce tutoriel nous allons voir comment afficher un Toast (un message court) juste après le click sur le bouton. Créer un nouveau projet Android comme décrit dans le tutoriel précédent  . Nous allons commencer par éditer le fichier "activity_main.xml" situé dans le dossier « res/layout ». Effacer le contenu de ce fichier et mettez ce code la : <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <Button android:id="@+id/buttonToast" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Click here !" /> </LinearLayout> Nous avons supprimé le code existant qui contient un TextView et nous avons mis un code qui contient un Button. Le bouto

Android tutorial for beginners:using Button, Listener and Toast

Image
This tutorials describes the usage of Buttons. we will start the course with a quick summary of the basic functions. What is a Listener?  A listener, as the name suggests, listens to a source until it is used.  For an action to be performed, it is necessary that a transmitter sends a signal to the listener that is triggered.  Action : Click on a button  Listener : Listen when the button is clicked  There is no simpler than that, we will see a  later in the examples how to implement a listener. Creating our project  As in the previous tutorial , with Eclipse and ADT, create a new project. We'll start by editing the "activity_main.xml" file located in the "res / layout" folder.  Its current syntax is as follows: <? xml version = "1.0" encoding = "utf-8" ?> <LinearLayout xmlns : android = "http://schemas.android.com/apk/res/android" android : orientation = "vertical" androi