LisView Emploi du Temps (Suite et fin)
Bonjour,
J'ai un problème concernant 2 listView, en effet elles agissent toute les deux sur une url mais je ne voit pas comment procéder, j'ai testé pas mal de chose et la dernière en date est une seconde listView à CheckBox, mais cela ne fonctionne pas non plus.
Une listView permet de choisir la semaine de l'emploi du temps et la seconde le nom de la personne concerné.
Voici mon code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
| package com.example.hfzd;
import java.util.ArrayList;
import java.util.List;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.CheckBox;
import android.widget.ListView;
public class EdtActivity extends MainActivity{
private WebView mWebView;
ListView liste = null;
ListView liste2 = null;
private int i = 0;
private int numeroprof;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_edt);
//DEFINIR LISTES
liste = (ListView) findViewById(R.id.listView1);
List<String> semaineListe = new ArrayList<String>();
liste2 = (ListView) findViewById(R.id.listView2);
List<String> profListe = new ArrayList<String>();
//REMPLIR LISTE
for(i=1;i<=40;i++){
semaineListe.add("Semaine "+i);
}
//REMPLIR LISTE PROF
profListe.add("Beaume Pierre");
profListe.add("Belmega");
profListe.add("Monchal Laurent");
//SET ADAPTER
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, semaineListe);
liste.setAdapter(adapter);
ArrayAdapter<String> adapter2 = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_checked, profListe);
liste2.setAdapter(adapter2);
//LISTENER LIST
liste.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view, int position,long id) {
// TODO Auto-generated method stub
mWebView = (WebView) findViewById(R.id.webview1);
mWebView.loadUrl("http://caligula.ensea.fr/ade/imageEt?&identifier=7401af2469b6698998e010cad148c867&projectId=1&idPianoWeek="+position+"&idPianoDay=0%2C1%2C2%2C3%2C4%2C5&idTree="+numeroprof+"&width=1018&height=607&lunchName=REPAS&displayMode=1057855&showLoad=false&ttl=1365603254272&displayConfId=7"); }
});
liste2.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view, int position,long id) {
// TODO Auto-generated method stub
switch (position){
case 1:
numeroprof = 148;
break;
case 2:
numeroprof = 304;
break;
case 3:
numeroprof = 165;
break;
}
}
});
}
} |
Merci d'avance de votre aide.