| 12
 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
 98
 99
 100
 101
 102
 103
 
 | package cbp.st2s;
 
import android.app.Activity;
import android.app.AlertDialog;
 
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
 
import cbp.st2s.CBPST2SActivity;
 
import cbp.st2s.Tab5;
 
import cbp.st2s.formulaire1;
 
 
import cbp.st2s.R;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Intent;
 
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.AdapterView.OnItemClickListener;
import android.os.Bundle;
 
 
public class Tab1 extends Activity {
	private ListView maListViewPerso;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.onglet1);
 
 
 
 
 
 
 
                maListViewPerso = (ListView) findViewById(R.id.listView1);
                ArrayList<HashMap<String, String>> listItem = new ArrayList<HashMap<String, String>>();
                HashMap<String, String> map;
                map = new HashMap<String, String>();
                map.put("titre", "1 - STI STL");
                map.put("img", String.valueOf(R.drawable.fleche));
                listItem.add(map);
                map = new HashMap<String, String>();
                map.put("titre", "2 - STI Bio");
                map.put("img", String.valueOf(R.drawable.fleche));
                listItem.add(map);
 
 
                SimpleAdapter mSchedule = new SimpleAdapter (this.getBaseContext(), listItem, R.layout.afichageitem,
                       new String[] {"img", "titre" }, new int[] {R.id.fleche, R.id.titre});
                maListViewPerso.setAdapter(mSchedule);
 
 
                maListViewPerso.setOnItemClickListener(new OnItemClickListener() {
              	  public void onItemClick(AdapterView<?> a, View v, int position, long id) {
 
 
 
              	    HashMap<String, String> map = (HashMap<String, String>) maListViewPerso.getItemAtPosition(position);
              	    if(map.get("titre").equals("1 - STI STL")) {
              	        startActivity(new Intent(Tab1.this, formulaire1.class));
              	        return;
              	    }
              	    if(map.get("titre").equals("2 - STI Bio")) {
              	        startActivity(new Intent(Tab1.this, formulaire2.class));
              	        return;
              	    }
 
 
 
 
 
 
 
 
            		      Intent intent = new Intent(Intent.ACTION_VIEW);
 
            		      startActivity(intent);
              	  };
                });
                }
 
 
 
      public void onClick(View src) {
    	    Intent i = new Intent(this, CBPST2SActivity.class);
    	    startActivity(i);
    	 };
      } | 
Partager