I wanted to import "latest.jason" from "OpenExchange rates" for latest currency rates.
But when I write "AsyncHttpClient" it creates the following "Un-Implemented Class":
@Override
public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
// TODO Auto-generated method stub
}
But I wanted this- (to run)
public void onSuccess(String arg2) {
Log.i("MYFIRSTAPP" , "HTTP Successs");
try {
JSONObject jsonObj = new JSONObject(arg2);
JSONObject ratesObject = jsonObj.getJSONObject("rates");
Double gbpRate = ratesObject.getDouble("GBP");
Double eurRate = ratesObject.getDouble("EUR");
Log.i("MYFIRSTAPP", "GBP" +gbpRate);
Log.i("MYFIRSTAPP", "EUR" +eurRate);
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
The problem I''m getting is: The onSuccess is taking " int arg0, Header[] arg1, byte[] arg2 " as the parameters...
but i wanted - " String arg2 "
Try This...