• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Calling String from Json and put it into CalendarView

Calling String from Json and put it into CalendarView

  • Over Event

    Votes: 1 100.0%
  • Directly into Calendar

    Votes: 0 0.0%

  • Total voters
    1

Criinx

Lurker
I have a String which is getting Data external from a MYSQL database into a TextView which shows me then the result.

Is it possible to show this Data string into a CalendarView? Or should I create Events...

In example getting string from SHIFT:

I need to put this SHIFT data into a CalendarView but every SHIFT is in a another day.

Code:
new getData().execute("");
}

private class getData extends AsyncTask<String, Void, String> {

    String name;

    @Override
    protected String doInBackground(String... params) {
    result = "";
        ipStr = null;

    try {
        HttpClient httpClient = new DefaultHttpClient();
        HttpPost httpPost = new HttpPost("link to php......");
        HttpResponse httpResponse = httpClient.execute(httpPost);
        HttpEntity entity = httpResponse.getEntity();
        ipStr = entity.getContent();
    }catch (Exception e){

        Log.e("Log_tag", "Error bei der Verbindung" + e.toString());
    }

    try {
        BufferedReader reader = new BufferedReader(new InputStreamReader(ipStr, "iso-8859-1"), 8);
        StringBuilder sb = new StringBuilder();
        String line = null;
        while ((line = reader.readLine()) != null){
            sb.append(line + "\n");
        }
        ipStr.close();

        result = sb.toString();
    }catch (Exception e){
        Log.e("log_tag", "Error bei der Konvertierung, daten wurden nicht erfolgreich gefunden" + e.toString());
    }
        try {
            JSONArray jArray = new JSONArray(result);
            for (int i = 0; i < jArray.length(); i++){
                JSONObject json = jArray.getJSONObject(i);

                Data = Data + "" + json.getString("schift");
                Data = Data + "" + json.getString("firstname");
                DataShortcut = DataShortcut + "" + json.getString("shortcut");
            }
        }catch (Exception e){
            Log.e("log_tag", "Error Analyserien der Dateien" + e.toString());
        }
        return "Executed";
    }
 
Back
Top Bottom