These are the instructions in my onCreate:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Client c = new Client();
String p=c.get();
((TextView) findViewById(R.id.textView)).setText(p);}
and this is my Client class
public class Client {
public String prova;
public String get() {
String url = "FILE_JSON_ONLINE_URL";
AsyncHttpClient client = new AsyncHttpClient();
client.get(url, null, new
JsonHttpResponseHandler() {
@Override
public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
prova = response.toString();
}
@Override
public void onFailure(int statusCode, Header[] headers, String res, Throwable t) {
}
});
return prova;
}
But my texview is empty, it's like the command client.get doesn't works, somebody can help me