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
|
dialogChargement = ProgressDialog.show(ListeReponses.this, "", getString(R.string.chargement), true, true, new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
threadConnexion.interrupt();
}
});
threadConnexion = new Thread(new Runnable() {
public void run() {
unJSONArray[0] = uneConnexionHTTP.chercherREP(uneIdentification.getPseudo());
runOnUiThread(new Runnable() {
@Override
public void run() {
try {
for (int i = 0; i < unJSONArray[0].length(); i++) {
JSONObject jsonLigne = unJSONArray[0].getJSONObject(i);
String pseudo = jsonLigne.getString("PSEUDOEXP");
String MSG = jsonLigne.getString("DATE");
HashMap<String, String> map = new HashMap<String, String>();
map.put("id", String.valueOf(i));
map.put("pseudo", pseudo);
map.put("MSG", MSG);
listItem.add(map);
}
} catch (JSONException e) {
e.printStackTrace();
}
}
});
dialogChargement.dismiss();
b[0] = false;
}
});
threadConnexion.start();
while(b[0])
{
} |
Partager