B4X:
public String checkCod(String sCod) {
JSONParser jsonParser = new JSONParser();
try {
List<NameValuePair> params = new ArrayList();
params.add(new BasicNameValuePair("id", "2"));
params.add(new BasicNameValuePair("key", "XXXXXXX"));
params.add(new BasicNameValuePair("cod", sCod));
JSONObject obj = jsonParser.makeHttpRequest(this.IP, params);
if (obj.getString("status").toString().equals("1")) {
return obj.getJSONObject("data").getString("content").toString();
}
return obj.getString("error_message").toString();
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
How can i translate this to b4a?