yimson Posted April 15, 2011 Share Posted April 15, 2011 Bonjour la communauté. Je suis débutant sur Android. J'ai pris le premier tutoriel Helloworld sur Android dans le site TUTOMOBILE.fr Je l'ai executé. Dans ma console d'eclipse, j'ai les messages suivant : [2011-04-15 16:13:46 - Tutoriel1_Android] ------------------------------ [2011-04-15 16:13:46 - Tutoriel1_Android] Android Launch! [2011-04-15 16:13:46 - Tutoriel1_Android] adb is running normally. [2011-04-15 16:13:46 - Tutoriel1_Android] Performing com.tutomobile.android.tuto1.Tutoriel1_Android activity launch [2011-04-15 16:13:46 - Tutoriel1_Android] Automatic Target Mode: launching new emulator with compatible AVD 'Android2.2' [2011-04-15 16:13:46 - Tutoriel1_Android] Launching a new emulator with Virtual Device 'Android2.2' [2011-04-15 16:13:54 - Tutoriel1_Android] New emulator found: emulator-5554 [2011-04-15 16:13:54 - Tutoriel1_Android] Waiting for HOME ('android.process.acore') to be launched... [2011-04-15 16:14:47 - Tutoriel1_Android] HOME is up on device 'emulator-5554' [2011-04-15 16:14:47 - Tutoriel1_Android] Uploading Tutoriel1_Android.apk onto device 'emulator-5554' [2011-04-15 16:14:48 - Tutoriel1_Android] Installing Tutoriel1_Android.apk... [2011-04-15 16:16:19 - Tutoriel1_Android] Success! [2011-04-15 16:16:20 - Tutoriel1_Android] Starting activity com.tutomobile.android.tuto1.Tutoriel1_Android on device emulator-5554 Et dans mon AVD, je ne vois rien s'afficher. Voici le code du fichier ACTIVITY. package com.tutomobile.android.tuto1; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; public class Tutoriel1_Android extends Activity { private EditText editText; private Button button; private String prenom; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); //récupération de l'EditText grâce à son ID editText = (EditText) findViewById(R.id.EditTextPrenom); //récupération du bouton grâce à son ID button = (Button) findViewById(R.id.ButtonEnvoyer); //on applique un écouteur d'évenement au clique sur le bouton button.setOnClickListener( new OnClickListener() { public void onClick(View v) { //on réupère le texte écrit dans l'EditText prenom = editText.getText().toString(); //on affiche "Hello votrePrenom ! " dans une petit pop-up qui s'affiche quelques seconde en bas d'écran Toast.makeText(Tutoriel1_Android.this, "Hello " + prenom + " !", Toast.LENGTH_LONG).show(); /*on affiche "Hello votrePrenom ! " dans un textView que l'on a créé tout à l'heure * et dont on avait pas précisé la valeur de son texte il s'agit du dernier TextView dans le fichier main.xml * De toute façon grâce à l'ID vous devrez facilement le trouver dans le fichier main.xml */ ((TextView)findViewById(R.id.TextViewHello)).setText("Hello " + prenom + " !"); } } ); } } Voici le code du MAIN.xml <?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" > <TextView android:id="@+id/TextViewPrenom" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/prenom" /> <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" > <EditText android:id="@+id/EditTextPrenom" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:layout_gravity="bottom" android:hint="@string/prenomHint" /> <Button android:id="@+id/ButtonEnvoyer" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/bouton" /> </LinearLayout> <TextView android:id="@+id/TextViewHello" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_gravity="center_horizontal" android:textSize="@dimen/dimMessage" android:textColor="@color/couleurMessage" /> </LinearLayout> SVP je sollicite votre aide pour avancer. Le problème est que dans mon AVD, j'ai juste la page d'accueil d'ANDROID qui s'affiche et rien de plus Merci Link to comment Share on other sites More sharing options...
laby Posted April 16, 2011 Share Posted April 16, 2011 Il faut peut etre deverouiller l'emulateur (comme avec le téléphone) Link to comment Share on other sites More sharing options...
yimson Posted April 19, 2011 Author Share Posted April 19, 2011 Il faut peut etre deverouiller l'emulateur (comme avec le téléphone) SVP comment procède-t-on pour dévérouiller l'émulateur ? Merci Link to comment Share on other sites More sharing options...
bioslord Posted April 19, 2011 Share Posted April 19, 2011 SVP comment procède-t-on pour dévérouiller l'émulateur ? Merci Il faut faire glisser le petit cadenas, comme si c'était un écran tactile avec la souris. Link to comment Share on other sites More sharing options...
RFOU Posted April 25, 2011 Share Posted April 25, 2011 Hello, J'avais le même souci ... et en faite il faut être patient, au bon d'un moment tu vois le logo Android de démarrage , tu arrives sur l'écran qui permet de déverrouiller ton ecran et tu arrives sur ton applis.. Je ne sais pas si le fait que ce soit long soit lié au fait que j'ai un pc qui n'est pas tout jeune... mais je trouve ça long [color=red]qd[/color] mm.... Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.