Vous êtes sur la page 1sur 4

Université Ibn Khaldoun Tiaret 2019/2020

Faculté de Mathématiques et d’Informatique


Département d'Informatique
Durée : 45min+ 15min

Examen du Module : Applications Mobiles

Donner la (es) bonne(s) réponse(s) aux questions suivantes.

1. Une application Android comporte par une activité principale et : (2 pts)


a. Eventuellement une ou plusieurs activités secondaires.
b. Eventuellement un ou plusieurs services.
c. Eventuellement plusieurs fichiers AndroidManifest.xml
d. Eventuellement plusieurs fichiers R
2. Quelle est la différence entre un groupe et un conteneur (donner des exemples
d’utilisation). 1pts
3. Soit la figure suivante illustrant l’arborescence d’une application :

a. Le projet Examen2020 utilise les ressources (fichiers) suivantes : (4pts)


- R.java,
- anim.xml
- qcm.docx
- barreme.exls
- Menu.xml,
Mentionner pour chaque ressource le dossier correspond
- icone1.ico, dans le projet Examen2020
- main.xml,
- Examen2020.apk
b. Le fichier AndroidManifest.xml peut contenir : (3pts)
- La configuration de l’application.
- Toutes les Layouts de l’application.
- Les services utilisés dans l’application.
c. Quel est le rôle de ressources contenues dans le dossier Android 6.0. (1pt)
4. Quelle est la méthode utilisée par Android pour démarrer une application. (1pt)
5. Quelle est l’objectif de la méthode setContentView(). (1pt)

6. Nous voulons passer de l’Activité « Act1 » à l’Activité « Act2 » quand on clique sur le
bouton « valider ». La méthode suivante est utilisée :
Valider.SetOnClick. . . . ..( new OnClick . . . .. ()){

@Override
public void onClick(. . . . .) {
Intent i = new Intent(act1, act2);
startActivity();

}
});

}
a. Compléter le code source du SetOnClick(). (2pt)
b. Citer les événements communs entre les vues dans une application Android. (2pts)
c. Chaque activité utilisée par une application doit être enregistrée dans le fichier «
AndroidManifest.xml» (a)-Vrai (b)-Faux (1pt)
d. Le fichier exécutable d’une application Android crée dans le dossier bin est
d’extension : (a)-.android, (b)- .exe, (c)-apke, (d)-jar, (e) .apk (f) .akp (1pt)

-------------------------------------------------------------------------------------------------
---
Partie TP/TD (14 pts)
7. Soit la méthode onCreate définie comme suit :

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.id.activity_act2);
Button ajouter=(Button) findViewById(R.id.button1);
TextView tv = (TextView) findViewById(R.layout.textView1);
tv.append(nom+ " "+ mat);
ajouter.setOnLongClickListener(new ………. {
…………………
public boolean onLongClick(View v) {
// TODO Auto-generated method stub
Toast.makeText(getApplicationContext(), "Examen 2020, CoronaVirus",
5000).show();
return false;
} }); }
a). Corriger la méthode onCreate() 2pts
b). Quelle est l’avantage de la méthode append() 1pts
c). Corriger et compléter le contenu de cette méthode (SetOnLongClickListner). 2pts
d). Modifier cette méthode pour l’appeler par xml. 2pts
8. Soit le code source suivant :
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
……………………..
………………………….

<ScrollView
android:id="@+id/scrollView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >

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

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

<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Nom" />

<EditText
android:id="@+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:singleLine="true"
android:ems="10" >

<requestFocus />
</EditText>
</LinearLayout>

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

<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Prénom" />

<EditText
android:id="@+id/editText2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:layout_weight="1"
android:ems="10" />
</LinearLayout>

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

<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Groupe" />

<EditText
android:id="@+id/editText3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:layout_weight="1"
android:ems="10" />
</LinearLayout>

<LinearLayout
android:layout_width="301dp"
android:layout_height="wrap_content"
android:layout_marginTop="60dp"
android:layout_weight="0.08"
android:gravity="center" >

<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.85"
android:text="Calculer" />

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

<Button
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Fermer" />
</LinearLayout>

</LinearLayout>

</ScrollView>

</RelativeLayout>

Donner (tracer) l'interface IHM défini par cette portion du code (7pts)

Bon courage

Vous aimerez peut-être aussi