public void sendMessage(View view) throws JSONException {
EditText text = (EditText)findViewById(R.id.jsonTxt);
String value = text.getText().toString(); // The JSON data is stored here
// The input parameter can be a JSONObject or a string
Izzati i = new Izzati(); // Initialize Izzati
JSONObject obj = new JSONObject(value);
i.url = "http://192.168.100.118:5020/"; // Set in Izzati, the URL
if (file == null) {
i.send(obj, new IzzatiJsonHandler() { // If there is no file selected, send JSON and expect JSON back
@Override
public void callback(JSONObject response) {
System.out.println(response); // Print out the response
}
});
} else {
i.send(obj, file, new IzzatiJsonHandler() { // If there is a file, simply specify it after the JSON
@Override
public void callback(JSONObject response) {
System.out.println(response);
}
});
}
}