hi im making a currency converter
i've made this part... i am getting the JSON file and i can see it on the LOGCAT... now my problem is that how can i get the JSON to convert it to string and parse it to float/double to enable me to manipulate them...
here is the code so far
import com.actionbarsherlock.app.SherlockActivity;
import com.loopj.android.http.AsyncHttpClient;
import com.loopj.android.http.AsyncHttpResponseHandler;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class MainActivity extends SherlockActivity {
private static final String API_URL = "my own api";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button btnConvert = (Button)findViewById(R.id.buttonConvert);
btnConvert.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
AsyncHttpClient client = new AsyncHttpClient();
client.get(API_URL, new AsyncHttpResponseHandler() {
@Override
public void onFailure(Throwable arg0, String arg1) {
// TODO Auto-generated method stub
super.onFailure(arg0, arg1);
}
@Override
public void onFinish() {
// TODO Auto-generated method stub
super.onFinish();
}
@Override
public void onStart() {
// TODO Auto-generated method stub
super.onStart();
}
@Override
public void onSuccess(String response) {
Log.i("CC", response);
}
});
}
});
}
}
i am really at a lost right now with a deadline coming at my doorstep