bonjour
je viens d'essayer les deux methodes pour comparer deux string
mais qouiqu'il soit le if me renvoie sur le else
voici mon code
Code java : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13 try { String str1 = new String("test"); response = customHttpClient.executeHttpPost("http:// xxxxx", postParameters); String str2=response.toString(); str2=str2.replaceAll("\\s+",""); int test=str2.toString().compareTo(str1); if(test==0){ Toast.makeText(getApplicationContext(), str2, Toast.LENGTH_LONG).show(); Editor edit = userpref.edit(); edit.putString("username",un.getText().toString()); edit.putString("password",pw.getText().toString()); edit.commit(); } else Toast.makeText(getApplicationContext(),"erreur", Toast.LENGTH_LONG).show();
le fichier PHP me renvoie test (<php.... echo 'test';......?>)
merci de votre aide
Partager