How to solve this ?

Posted by Karthick on Stack Overflow See other posts from Stack Overflow or by Karthick
Published on 2010-06-18T12:59:29Z Indexed on 2010/06/18 13:03 UTC
Read the original article Hit count: 147

Filed under:

Hi all. I use the following code in java. It works well and it adds events into Google calendar. But in android it gives the Exception “Error connecting with login URI”.Can anyone help me to solve this??

CalendarService myService = new CalendarService("calendarTest");
String userName = "[email protected]"; String userPassword = "xxxxxxx";

     // Create the necessary URL objects.
     try {
       metafeedUrl = new URL(METAFEED_URL_BASE + userName);
       eventFeedUrl = new URL(METAFEED_URL_BASE + userName
           + EVENT_FEED_URL_SUFFIX);
     } catch (MalformedURLException e) {
       // Bad URL
      strbuf.append(e.getMessage());
       System.err.println("Uh oh - you've got an invalid URL.");
       e.printStackTrace();
       return;
     }

     try 
     {          
       myService.setUserCredentials(userName, userPassword);
       // Demonstrate creating a single-occurrence event.
       CalendarEventEntry singleEvent = createSingleEvent(myService,"Event Title", "Event Description ");         
       System.out.println("Successfully created event " +singleEvent.getTitle().getPlainText() );

       // Demonstrate creating a quick add event.
       CalendarEventEntry quickAddEvent = createQuickAddEvent(myService,"Tennis with me June 22 3pm-3:30pm");           
       System.out.println("Successfully created quick add event "       + quickAddEvent.getTitle().getPlainText());          

     } 

catch.......

© Stack Overflow or respective owner

Related posts about android