0

Could you tell me how can i save my last Callback data ? I would like to use it offline . Thanks for reading Regards

public void onClick(View v) {

    final Double waluta_from_wartosc = Double.valueOf(editText_waluty.getText().toString());
    String from_waluta = String.valueOf(spinner_from.getSelectedItem());
    String to_waluta = String.valueOf(spinner_to.getSelectedItem());

    String url = base_url + "from=" + from_waluta + "&to=" + to_waluta;

    aq.ajax(url, JSONObject.class, new AjaxCallback<JSONObject>() {

        @Override
        public void callback(String url, JSONObject json, AjaxStatus status) {

            if (json != null) {

                try 
                {
                    Double rate = json.getDouble("rate");
                    double the_result = waluta_from_wartosc * rate;
                    textview_to.setText(String.valueOf(the_result) + " " + spinner_to.getSelectedItem().toString());
                 } 
                 catch (JSONException e) 
                 {
                     e.printStackTrace();
                 }
             } 
             else {
                 Toast.makeText(aq.getContext(), "BRAK DOSTĘPU DO INTERNETU!!!", Toast.LENGTH_SHORT).show();
Kurt Van den Branden
  • 11,995
  • 10
  • 76
  • 85

1 Answers1

0

Use Shared Preferences or SQLite db to store the data. Go through this

Yuvisiva
  • 11
  • 5