구글캘린더에서 일정을 받아 리스트뷰에 출력하는 앱인데여
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import com.google.gdata.client.GoogleService;
import com.google.gdata.client.calendar.CalendarService;
import com.google.gdata.data.calendar.CalendarEntry;
import com.google.gdata.data.calendar.CalendarFeed;
import com.google.gdata.util.AuthenticationException;
import com.google.gdata.util.ServiceException;
public class GoogleCalActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
void addCalendarEntry(String googleUser, String password)
throws Exception {
URL post = new URL("http://www.google.com/calendar/feeds/" + "계정명" + "/private/full");
CalendarService myService = new CalendarService("myCompany-exampleApp-1.0");
try {
myService.setUserCredentials("지멜계정", "계정비번");
} catch (AuthenticationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// Send the request and print the response
URL feedUrl = null;
try {
feedUrl = new URL("https://www.google.com/calendar/feeds/default/allcalendars/full");
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
CalendarFeed resultFeed = null;
try {
resultFeed = myService.getFeed(feedUrl, CalendarFeed.class);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
ArrayList<String> arGeneral = new ArrayList<String>();
for (int i = 0; i < resultFeed.getEntries().size(); i++) {
CalendarEntry entry = resultFeed.getEntries().get(i);
arGeneral.add(entry.getTitle().getPlainText());
}
ArrayAdapter<String> Adapter;
Adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, arGeneral);
TextView tv = (TextView)findViewById(R.id.selection);
ListView list = (ListView)findViewById(tv);
list.setAdapter(Adapter);
}
private ListView findViewById(TextView tv) {
// TODO Auto-generated method stub
return null;
}
}
요소스에서는 에러가 안나는데 에뮬만 돌리면 에러가 나요...
로그켓은
07-26 02:48:30.292: ERROR/Zygote(32): setreuid() failed. errno: 2
07-26 02:48:40.482: ERROR/Zygote(32): setreuid() failed. errno: 17
07-26 02:48:42.064: ERROR/BatteryService(60): usbOnlinePath not found
07-26 02:48:42.064: ERROR/BatteryService(60): batteryVoltagePath not found
07-26 02:48:42.064: ERROR/BatteryService(60): batteryTemperaturePath not found
07-26 02:48:42.082: ERROR/SurfaceFlinger(60): Couldn't open /sys/power/wait_for_fb_sleep or /sys/power/wait_for_fb_wake
07-26 02:48:42.312: ERROR/SensorService(60): couldn't open device for module sensors (Invalid argument)
07-26 02:48:48.703: ERROR/System(60): Failure starting core service
07-26 02:48:48.703: ERROR/System(60): java.lang.SecurityException
07-26 02:48:48.703: ERROR/System(60): at android.os.BinderProxy.transact(Native Method)
07-26 02:48:48.703: ERROR/System(60): at android.os.ServiceManagerProxy.addService(ServiceManagerNative.java:146)
07-26 02:48:48.703: ERROR/System(60): at android.os.ServiceManager.addService(ServiceManager.java:72)
07-26 02:48:48.703: ERROR/System(60): at com.android.server.ServerThread.run(SystemServer.java:206)
07-26 02:48:48.723: ERROR/EventHub(60): could not get driver version for /dev/input/mouse0, Not a typewriter
07-26 02:48:48.723: ERROR/EventHub(60): could not get driver version for /dev/input/mice, Not a typewriter
07-26 02:48:49.144: ERROR/SoundPool(60): error loading /system/media/audio/ui/Effect_Tick.ogg
07-26 02:48:49.144: ERROR/SoundPool(60): error loading /system/media/audio/ui/KeypressStandard.ogg
07-26 02:48:49.153: ERROR/SoundPool(60): error loading /system/media/audio/ui/KeypressSpacebar.ogg
07-26 02:48:49.153: ERROR/SoundPool(60): error loading /system/media/audio/ui/KeypressDelete.ogg
07-26 02:48:49.163: ERROR/SoundPool(60): error loading /system/media/audio/ui/KeypressReturn.ogg
07-26 02:48:49.193: ERROR/UsbObserver(60): java.lang.NullPointerException
07-26 02:48:49.193: ERROR/UsbObserver(60): at com.android.server.UsbObserver.init(UsbObserver.java:131)
07-26 02:48:49.193: ERROR/UsbObserver(60): at com.android.server.UsbObserver.<init>(UsbObserver.java:65)
07-26 02:48:49.193: ERROR/UsbObserver(60): at com.android.server.ServerThread.run(SystemServer.java:402)
07-26 02:48:50.034: ERROR/ThrottleService(60): Could not open GPS configuration file /etc/gps.conf
07-26 02:48:53.253: ERROR/logwrapper(174): executing /system/bin/tc failed: No such file or directory
07-26 02:48:53.343: ERROR/logwrapper(175): executing /system/bin/tc failed: No such file or directory
07-26 02:48:53.413: ERROR/logwrapper(178): executing /system/bin/tc failed: No such file or directory
07-26 02:49:34.430: ERROR/dalvikvm(367): Could not find class 'com.google.gdata.client.calendar.CalendarService', referenced from method org.android.com.GoogleCalActivity.addCalendarEntry
07-26 02:59:25.680: ERROR/InputDispatcher(60): channel '408714e0 org.android.com/org.android.com.GoogleCalActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x8
07-26 02:59:25.680: ERROR/InputDispatcher(60): channel '408714e0 org.android.com/org.android.com.GoogleCalActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
07-26 02:59:30.429: ERROR/dalvikvm(400): Could not find class 'com.google.gdata.client.calendar.CalendarService', referenced from method org.android.com.GoogleCalActivity.addCalendarEntry
일케뜨는데 뭐 어캐해야 하는지 모르겠네요 ㅠㅠ 좀 도와주세요 ㅠ




07-26 02:59:30.429: ERROR/dalvikvm(400): Could not find class 'com.google.gdata.client.calendar.CalendarService', referenced from method org.android.com.GoogleCalActivity.addCalendarEntry
addClendarEntry() 에서 사용한 CalendarService 를 찾을 수 없다고 합니다.
예전 비슷한 문의에 대해 다음과 같은 답변이 있군요.
http://www.androidpub.com/1227912