
-
Senior Member
http request / json
ciao a tutti, sono nuovo di android (arrivo dal mondo ios xcode), vorrei fare porting di una mia app e vorrei usare http request e json cosa consigliate? (ovviamente x android studio)
-
Senior Member
volleyplus, ti permette di fare tutto con estrema facilità!
-
Senior Member
dove posso trovare info su come installare librerie esterne con android studio? usando librerie tipo volleyplus posso pubblicare senza problemi su playstore?
-
Senior Member
ti basta inserire "compile 'dev.dworks.libs:volleyplus:+'" nel gradle, poi si puoi caricre l'app sullo store senza problemi
-
Senior Member
ciao, io ho trovato il seguente esempio:
JsonObjectRequest jsonObjReq = new JsonObjectRequest(Method.GET,
urlJsonObj, null, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
Log.d(TAG, response.toString());
try {
// Parsing json object response
// response will be a json object
String name = response.getString("name");
String email = response.getString("email");
JSONObject phone = response.getJSONObject("phone");
String home = phone.getString("home");
String mobile = phone.getString("mobile");
jsonResponse = "";
jsonResponse += "Name: " + name + "\n\n";
jsonResponse += "Email: " + email + "\n\n";
jsonResponse += "Home: " + home + "\n\n";
jsonResponse += "Mobile: " + mobile + "\n\n";
txtResponse.setText(jsonResponse);
} catch (JSONException e) {
e.printStackTrace();
Toast.makeText(getApplicationContext(),
"Error: " + e.getMessage(),
Toast.LENGTH_LONG).show();
}
hidepDialog();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
VolleyLog.d(TAG, "Error: " + error.getMessage());
Toast.makeText(getApplicationContext(),
error.getMessage(), Toast.LENGTH_SHORT).show();
// hide the progress dialog
hidepDialog();
}
});
// Adding request to request queue
AppController.getInstance().addToRequestQueue(json ObjReq);
però che import devo fare per poterlo compilare?
-
Senior Member
risolto non avevo messo tutti i vari import
Tag per Questa Discussione
Permessi di Scrittura
- Tu non puoi inviare nuove discussioni
- Tu non puoi inviare risposte
- Tu non puoi inviare allegati
- Tu non puoi modificare i tuoi messaggi
-
Regole del Forum