Bonjour Tout le monde


Voila j'ai une ListView composé par des données ( regarder l'image )



je veux trouvé une solution pour que j'affiche les donnée suivant L'IMEI ( colleur en Vert dans la photo ) par ordre croissant ou décroissent...


Probléme: Afficher les donnée par catégorie ( par exemple dans mon cas il affiche IMEI1 IMEI2 IMEI3 .... et quand je clic sur l'un d'eux il m'affiche tout les info sur les IMEI qui porte le méme numéro )


voici le code PHP :

Code PHP : Sélectionner tout - Visualiser dans une fenêtre à part
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
<?php
 
 $base = mysql_connect ('localhost', 'root', '');  
 mysql_select_db ('trackeur', $base) ;  
$p=0;
$req = mysql_query("select * from clients WHERE username = 'roger'");
while($dnn = mysql_fetch_array($req))
{
$v="A";
$IMEI = $dnn['IMEI'];
 
$req1 = mysql_query("select * from data WHERE IMEI = '$IMEI' ORDER BY id DESC");
while($row1 = mysql_fetch_array($req1))
 
{   
     $output1[]=$row1;    
  }
 
  }
 //on encode en JSON 
 
echo("{\"general\":");
 print(json_encode($output1));
 echo("}");
 
 mysql_free_result ($req1);  
 $lat = $row1['Latitude']/100;
$lng = $row1['Longitude']/100;
$url = "http://maps.google.com/maps/geo?q=$lat,$lng&amp;output=json&amp;sensor=false";
$data = @file_get_contents($url);          //read the HTTP request
$jsondata = json_decode($data,true);       //parse the JSOPN response
 
?>



et voila le Code Java

Code JAVA : Sélectionner tout - Visualiser dans une fenêtre à part
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
package com.diablo;
 
import java.util.ArrayList;
import java.util.HashMap;
 
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
 
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;
 
public class InfoMapG extends ListActivity {
 
	// url to make request
	private static String url = "http://10.0.2.2/member.php";
 
	// JSON Node names
	private static final String TAG_Contact = "general";
	private static final String TAG_IMEI = "IMEI";
	private static final String TAG_id = "id";
	private static final String TAG_Date = "Date";
	private static final String TAG_Latitude = "Latitude";
	private static final String TAG_Heure = "Heure";
	private static final String TAG_Statut = "Statut";
	private static final String TAG_Battery = "Battery";
	private static final String TAG_Longitude = "Longitude";
 
	// contacts JSONArray
	JSONArray contacts = null;
 
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.infomapgenral);
 
		// Hashmap for ListView
		ArrayList<HashMap<String, String>> contactList = new ArrayList<HashMap<String, String>>();
 
		// Creating JSON Parser instance
		JSONParser jParser = new JSONParser();
 
		// getting JSON string from URL
		JSONObject json = jParser.getJSONFromUrl(url);
 
		try {
			// Getting Array of Contacts
			contacts = json.getJSONArray(TAG_Contact);
 
			// looping through All Contacts
			for(int i = 0; i < contacts.length(); i++){
				JSONObject c = contacts.getJSONObject(i);
 
				// Storing each json item in variable
				String id = c.getString(TAG_id);
				String IMEI = c.getString(TAG_IMEI);
				String Date = c.getString(TAG_Date);
				String Latitude = c.getString(TAG_Latitude);
				String Heure = c.getString(TAG_Heure);
				String Longitude = c.getString(TAG_Longitude);
 
 
				// creating new HashMap
				HashMap<String, String> map = new HashMap<String, String>();
 
				// adding each child node to HashMap key => value
				map.put(TAG_id, id);
				map.put(TAG_IMEI, IMEI);
				map.put(TAG_Date, Date);
				map.put(TAG_Longitude, Longitude);
				map.put(TAG_Latitude, Latitude);
				// adding HashList to ArrayList
				contactList.add(map);
			}
		} catch (JSONException e) {
			e.printStackTrace();
		}
 
 
		/**
                 * Updating parsed JSON data into ListView
                 * */
		ListAdapter adapter = new SimpleAdapter(this, contactList,
				R.layout.list_item,
				new String[] { TAG_IMEI, TAG_Date, TAG_Latitude, TAG_Longitude },new int[] {
				R.id.IMEI, R.id.date, R.id.latitude, R.id.longitude });
 
		setListAdapter(adapter);
 
		// selecting single ListView item
		ListView lv = getListView();
 
		// Launching new screen on Selecting Single ListItem
		lv.setOnItemClickListener(new OnItemClickListener() {
 
 
			public void onItemClick(AdapterView<?> parent, View view,int position, long id) {
				// getting values from selected ListItem
				String imei = ((TextView) view.findViewById(R.id.IMEI)).getText().toString();
				String date = ((TextView) view.findViewById(R.id.date)).getText().toString();
				String latitude = ((TextView) view.findViewById(R.id.latitude)).getText().toString();
				String longitude = ((TextView) view.findViewById(R.id.longitude)).getText().toString();
 
				// Starting new intent
				Intent in = new Intent(getApplicationContext(), SingleMenuItem.class);
				in.putExtra(TAG_IMEI, imei);
				in.putExtra(TAG_Date, date);
				in.putExtra(TAG_Latitude, latitude);
				in.putExtra(TAG_Longitude, longitude);
				startActivity(in);
 
			}
		});
 
 
 
	}
 
}



sa serai gentille si quelqu'un peu m'aidai pour modifier mon code et obtenir ce que je veux ou me donnée un exemple sur un truc qui ressemble a sa
et Merci d'avance