0

I need a simple working example with all the relevant import. I found only one example but its too complicated and many imports are missing

Wesley Wiser
  • 9,491
  • 4
  • 50
  • 69
Canttouchit
  • 3,149
  • 6
  • 38
  • 51

1 Answers1

1

Okay I've found a better solution I written this using HttpGet

    /***************************************************************************************************************************/
/*                        RETURNS Calendar List                                                                            */
/***************************************************************************************************************************/
//@param authKey, represents the token key ,Auth=......
public void calendarList(String authKey){ 

    HttpClient httpclient = new DefaultHttpClient();
    HttpGet httpget = new HttpGet("https://www.google.com/calendar/feeds/default/allcalendars/full");
    httpget.setHeader("Authorization","GoogleLogin "+authKey);


    // Execute HTTP Post Request
    org.apache.http.HttpResponse response; 
    try {
        response = httpclient.execute(httpget);
        HttpEntity httpEntity = response.getEntity();

        InputStream stream = httpEntity.getContent();
        BufferedReader reader = new BufferedReader(new InputStreamReader(stream));

        StringBuilder total = new StringBuilder();
        String line;
        while ((line = reader.readLine()) != null) {
            total.append(line);
            Log.d("RESPONSE LIST",line+"\n");                               
        }



    } catch (ClientProtocolException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

}
Canttouchit
  • 3,149
  • 6
  • 38
  • 51