java - App is force closing when i run it? Unable to start activity -
when run app, , press on button force closes. fixed android manifest , cannot find problem. here logcat:
03-07 23:48:53.035: d/dalvikvm(5457): gc_external_alloc freed 43k, 49% free 2797k/5379k, external 1596k/2108k, paused 99ms 03-07 23:48:53.132: d/dalvikvm(5457): gc_external_alloc freed 1k, 49% free 2796k/5379k, external 3471k/4335k, paused 35ms 03-07 23:48:53.691: d/dalvikvm(5457): gc_external_alloc freed <1k, 48% free 2798k/5379k, external 5048k/5580k, paused 53ms 03-07 23:48:54.281: d/dalvikvm(5457): gc_external_alloc freed <1k, 48% free 2799k/5379k, external 8143k/8403k, paused 48ms 03-07 23:48:55.996: d/androidruntime(5457): shutting down vm 03-07 23:48:55.996: w/dalvikvm(5457): threadid=1: thread exiting uncaught exception (group=0x40015578) 03-07 23:48:56.039: e/androidruntime(5457): fatal exception: main 03-07 23:48:56.039: e/androidruntime(5457): android.content.activitynotfoundexception: unable find explicit activity class {izzy.n/izzy.n.main1}; have declared activity in androidmanifest.xml? 03-07 23:48:56.039: e/androidruntime(5457): @ android.app.instrumentation.checkstartactivityresult(instrumentation.java:1405) 03-07 23:48:56.039: e/androidruntime(5457): @ android.app.instrumentation.execstartactivity(instrumentation.java:1379) 03-07 23:48:56.039: e/androidruntime(5457): @ android.app.activity.startactivityforresult(activity.java:2827) 03-07 23:48:56.039: e/androidruntime(5457): @ android.app.activity.startactivity(activity.java:2933) 03-07 23:48:56.039: e/androidruntime(5457): @ izzy.n.izzynactivity$2.onclick(izzynactivity.java:31) 03-07 23:48:56.039: e/androidruntime(5457): @ android.view.view.performclick(view.java:2538) 03-07 23:48:56.039: e/androidruntime(5457): @ android.view.view$performclick.run(view.java:9152) 03-07 23:48:56.039: e/androidruntime(5457): @ android.os.handler.handlecallback(handler.java:587) 03-07 23:48:56.039: e/androidruntime(5457): @ android.os.handler.dispatchmessage(handler.java:92) 03-07 23:48:56.039: e/androidruntime(5457): @ android.os.looper.loop(looper.java:130) 03-07 23:48:56.039: e/androidruntime(5457): @ android.app.activitythread.main(activitythread.java:3687) 03-07 23:48:56.039: e/androidruntime(5457): @ java.lang.reflect.method.invokenative(native method) 03-07 23:48:56.039: e/androidruntime(5457): @ java.lang.reflect.method.invoke(method.java:507) 03-07 23:48:56.039: e/androidruntime(5457): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:842) 03-07 23:48:56.039: e/androidruntime(5457): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:600) 03-07 23:48:56.039: e/androidruntime(5457): @ dalvik.system.nativestart.main(native method) 03-07 23:50:31.398: d/dalvikvm(5553): gc_external_alloc freed 47k, 49% free 2797k/5379k, external 1596k/2108k, paused 21ms 03-07 23:50:31.457: d/dalvikvm(5553): gc_external_alloc freed 1k, 49% free 2796k/5379k, external 3471k/4335k, paused 22ms 03-07 23:50:31.660: d/dalvikvm(5553): gc_external_alloc freed <1k, 48% free 2798k/5379k, external 5048k/5580k, paused 25ms 03-07 23:50:31.753: d/dalvikvm(5553): gc_external_alloc freed <1k, 48% free 2799k/5379k, external 8143k/8403k, paused 20ms 03-07 23:50:41.910: d/androidruntime(5553): shutting down vm 03-07 23:50:41.910: w/dalvikvm(5553): threadid=1: thread exiting uncaught exception (group=0x40015578) 03-07 23:50:41.933: e/androidruntime(5553): fatal exception: main 03-07 23:50:41.933: e/androidruntime(5553): android.content.activitynotfoundexception: unable find explicit activity class {izzy.n/izzy.n.main1}; have declared activity in androidmanifest.xml? 03-07 23:50:41.933: e/androidruntime(5553): @ android.app.instrumentation.checkstartactivityresult(instrumentation.java:1405) 03-07 23:50:41.933: e/androidruntime(5553): @ android.app.instrumentation.execstartactivity(instrumentation.java:1379) 03-07 23:50:41.933: e/androidruntime(5553): @ android.app.activity.startactivityforresult(activity.java:2827) 03-07 23:50:41.933: e/androidruntime(5553): @ android.app.activity.startactivity(activity.java:2933) 03-07 23:50:41.933: e/androidruntime(5553): @ izzy.n.izzynactivity$2.onclick(izzynactivity.java:31) 03-07 23:50:41.933: e/androidruntime(5553): @ android.view.view.performclick(view.java:2538) 03-07 23:50:41.933: e/androidruntime(5553): @ android.view.view$performclick.run(view.java:9152) 03-07 23:50:41.933: e/androidruntime(5553): @ android.os.handler.handlecallback(handler.java:587) 03-07 23:50:41.933: e/androidruntime(5553): @ android.os.handler.dispatchmessage(handler.java:92) 03-07 23:50:41.933: e/androidruntime(5553): @ android.os.looper.loop(looper.java:130) 03-07 23:50:41.933: e/androidruntime(5553): @ android.app.activitythread.main(activitythread.java:3687) 03-07 23:50:41.933: e/androidruntime(5553): @ java.lang.reflect.method.invokenative(native method) 03-07 23:50:41.933: e/androidruntime(5553): @ java.lang.reflect.method.invoke(method.java:507) 03-07 23:50:41.933: e/androidruntime(5553): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:842) 03-07 23:50:41.933: e/androidruntime(5553): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:600) 03-07 23:50:41.933: e/androidruntime(5553): @ dalvik.system.nativestart.main(native method) 03-07 23:51:20.371: d/dalvikvm(5609): gc_external_alloc freed 48k, 49% free 2797k/5379k, external 1596k/2108k, paused 97ms 03-07 23:51:20.503: d/dalvikvm(5609): gc_external_alloc freed 1k, 49% free 2796k/5379k, external 3471k/4335k, paused 57ms 03-07 23:51:20.792: d/dalvikvm(5609): gc_external_alloc freed <1k, 48% free 2798k/5379k, external 5048k/5580k, paused 24ms 03-07 23:51:21.039: d/dalvikvm(5609): gc_external_alloc freed <1k, 48% free 2799k/5379k, external 8143k/8403k, paused 65ms 03-07 23:51:26.679: d/androidruntime(5609): shutting down vm 03-07 23:51:26.679: w/dalvikvm(5609): threadid=1: thread exiting uncaught exception (group=0x40015578) 03-07 23:51:26.714: e/androidruntime(5609): fatal exception: main 03-07 23:51:26.714: e/androidruntime(5609): android.content.activitynotfoundexception: unable find explicit activity class {izzy.n/izzy.n.main1}; have declared activity in androidmanifest.xml? 03-07 23:51:26.714: e/androidruntime(5609): @ android.app.instrumentation.checkstartactivityresult(instrumentation.java:1405) 03-07 23:51:26.714: e/androidruntime(5609): @ android.app.instrumentation.execstartactivity(instrumentation.java:1379) 03-07 23:51:26.714: e/androidruntime(5609): @ android.app.activity.startactivityforresult(activity.java:2827) 03-07 23:51:26.714: e/androidruntime(5609): @ android.app.activity.startactivity(activity.java:2933) 03-07 23:51:26.714: e/androidruntime(5609): @ izzy.n.izzynactivity$2.onclick(izzynactivity.java:31) 03-07 23:51:26.714: e/androidruntime(5609): @ android.view.view.performclick(view.java:2538) 03-07 23:51:26.714: e/androidruntime(5609): @ android.view.view$performclick.run(view.java:9152) 03-07 23:51:26.714: e/androidruntime(5609): @ android.os.handler.handlecallback(handler.java:587) 03-07 23:51:26.714: e/androidruntime(5609): @ android.os.handler.dispatchmessage(handler.java:92) 03-07 23:51:26.714: e/androidruntime(5609): @ android.os.looper.loop(looper.java:130) 03-07 23:51:26.714: e/androidruntime(5609): @ android.app.activitythread.main(activitythread.java:3687) 03-07 23:51:26.714: e/androidruntime(5609): @ java.lang.reflect.method.invokenative(native method) 03-07 23:51:26.714: e/androidruntime(5609): @ java.lang.reflect.method.invoke(method.java:507) 03-07 23:51:26.714: e/androidruntime(5609): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:842) 03-07 23:51:26.714: e/androidruntime(5609): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:600) 03-07 23:51:26.714: e/androidruntime(5609): @ dalvik.system.nativestart.main(native method) 03-07 23:59:24.920: d/dalvikvm(5784): gc_external_alloc freed 51k, 49% free 2797k/5379k, external 1596k/2108k, paused 54ms 03-07 23:59:25.104: d/dalvikvm(5784): gc_external_alloc freed 1k, 49% free 2796k/5379k, external 3471k/4335k, paused 46ms 03-07 23:59:25.537: d/dalvikvm(5784): gc_external_alloc freed <1k, 48% free 2798k/5379k, external 5048k/5580k, paused 24ms 03-07 23:59:25.846: d/dalvikvm(5784): gc_external_alloc freed <1k, 48% free 2799k/5379k, external 8143k/8403k, paused 38ms 03-07 23:59:41.502: d/dalvikvm(5784): gc_external_alloc freed 10k, 48% free 2828k/5379k, external 11785k/11958k, paused 25ms 03-07 23:59:41.740: d/dalvikvm(5784): gc_external_alloc freed <1k, 48% free 2829k/5379k, external 13363k/14068k, paused 25ms 03-07 23:59:41.865: d/dalvikvm(5784): gc_external_alloc freed <1k, 48% free 2830k/5379k, external 16457k/17091k, paused 20ms 03-07 23:59:42.607: d/androidruntime(5784): shutting down vm 03-07 23:59:42.607: w/dalvikvm(5784): threadid=1: thread exiting uncaught exception (group=0x40015578) 03-07 23:59:42.783: e/androidruntime(5784): fatal exception: main 03-07 23:59:42.783: e/androidruntime(5784): java.lang.runtimeexception: unable start activity componentinfo{izzy.n/izzy.n.main1}: java.lang.nullpointerexception 03-07 23:59:42.783: e/androidruntime(5784): @ android.app.activitythread.performlaunchactivity(activitythread.java:1651) 03-07 23:59:42.783: e/androidruntime(5784): @ android.app.activitythread.handlelaunchactivity(activitythread.java:1667) 03-07 23:59:42.783: e/androidruntime(5784): @ android.app.activitythread.access$1500(activitythread.java:117) 03-07 23:59:42.783: e/androidruntime(5784): @ android.app.activitythread$h.handlemessage(activitythread.java:935) 03-07 23:59:42.783: e/androidruntime(5784): @ android.os.handler.dispatchmessage(handler.java:99) 03-07 23:59:42.783: e/androidruntime(5784): @ android.os.looper.loop(looper.java:130) 03-07 23:59:42.783: e/androidruntime(5784): @ android.app.activitythread.main(activitythread.java:3687) 03-07 23:59:42.783: e/androidruntime(5784): @ java.lang.reflect.method.invokenative(native method) 03-07 23:59:42.783: e/androidruntime(5784): @ java.lang.reflect.method.invoke(method.java:507) 03-07 23:59:42.783: e/androidruntime(5784): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:842) 03-07 23:59:42.783: e/androidruntime(5784): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:600) 03-07 23:59:42.783: e/androidruntime(5784): @ dalvik.system.nativestart.main(native method) 03-07 23:59:42.783: e/androidruntime(5784): caused by: java.lang.nullpointerexception 03-07 23:59:42.783: e/androidruntime(5784): @ izzy.n.main1.populatecalendarspinner(main1.java:62) 03-07 23:59:42.783: e/androidruntime(5784): @ izzy.n.main1.oncreate(main1.java:52) 03-07 23:59:42.783: e/androidruntime(5784): @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1047) 03-07 23:59:42.783: e/androidruntime(5784): @ android.app.activitythread.performlaunchactivity(activitythread.java:1615) 03-07 23:59:42.783: e/androidruntime(5784): ... 11 more 03-07 23:59:52.850: i/process(5784): sending signal. pid: 5784 sig: 9 03-08 00:11:06.982: d/dalvikvm(6029): gc_external_alloc freed 46k, 49% free 2797k/5379k, external 1596k/2108k, paused 29ms 03-08 00:11:07.033: d/dalvikvm(6029): gc_external_alloc freed 1k, 49% free 2796k/5379k, external 3471k/4335k, paused 20ms 03-08 00:11:07.248: d/dalvikvm(6029): gc_external_alloc freed <1k, 48% free 2798k/5379k, external 5048k/5580k, paused 21ms 03-08 00:11:07.350: d/dalvikvm(6029): gc_external_alloc freed <1k, 48% free 2799k/5379k, external 8143k/8403k, paused 19ms 03-08 00:11:10.588: d/dalvikvm(6029): gc_external_alloc freed 9k, 48% free 2828k/5379k, external 11785k/11958k, paused 100ms 03-08 00:11:11.068: d/dalvikvm(6029): gc_external_alloc freed 1k, 48% free 2829k/5379k, external 13363k/14068k, paused 49ms 03-08 00:11:11.365: d/dalvikvm(6029): gc_external_alloc freed <1k, 48% free 2830k/5379k, external 16457k/17091k, paused 47ms 03-08 00:11:11.736: d/androidruntime(6029): shutting down vm 03-08 00:11:11.736: w/dalvikvm(6029): threadid=1: thread exiting uncaught exception (group=0x40015578) 03-08 00:11:11.752: e/androidruntime(6029): fatal exception: main 03-08 00:11:11.752: e/androidruntime(6029): java.lang.runtimeexception: unable start activity componentinfo{izzy.n/izzy.n.main1}: java.lang.nullpointerexception 03-08 00:11:11.752: e/androidruntime(6029): @ android.app.activitythread.performlaunchactivity(activitythread.java:1651) 03-08 00:11:11.752: e/androidruntime(6029): @ android.app.activitythread.handlelaunchactivity(activitythread.java:1667) 03-08 00:11:11.752: e/androidruntime(6029): @ android.app.activitythread.access$1500(activitythread.java:117) 03-08 00:11:11.752: e/androidruntime(6029): @ android.app.activitythread$h.handlemessage(activitythread.java:935) 03-08 00:11:11.752: e/androidruntime(6029): @ android.os.handler.dispatchmessage(handler.java:99) 03-08 00:11:11.752: e/androidruntime(6029): @ android.os.looper.loop(looper.java:130) 03-08 00:11:11.752: e/androidruntime(6029): @ android.app.activitythread.main(activitythread.java:3687) 03-08 00:11:11.752: e/androidruntime(6029): @ java.lang.reflect.method.invokenative(native method) 03-08 00:11:11.752: e/androidruntime(6029): @ java.lang.reflect.method.invoke(method.java:507) 03-08 00:11:11.752: e/androidruntime(6029): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:842) 03-08 00:11:11.752: e/androidruntime(6029): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:600) 03-08 00:11:11.752: e/androidruntime(6029): @ dalvik.system.nativestart.main(native method) 03-08 00:11:11.752: e/androidruntime(6029): caused by: java.lang.nullpointerexception 03-08 00:11:11.752: e/androidruntime(6029): @ izzy.n.main1.populatecalendarspinner(main1.java:62) 03-08 00:11:11.752: e/androidruntime(6029): @ izzy.n.main1.oncreate(main1.java:52) 03-08 00:11:11.752: e/androidruntime(6029): @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1047) 03-08 00:11:11.752: e/androidruntime(6029): @ android.app.activitythread.performlaunchactivity(activitythread.java:1615) 03-08 00:11:11.752: e/androidruntime(6029): ... 11 more 03-08 00:16:11.924: i/process(6029): sending signal. pid: 6029 sig: 9 03-08 00:16:14.525: d/dalvikvm(6173): gc_external_alloc freed 10k, 48% free 2828k/5379k, external 11785k/11958k, paused 20ms 03-08 00:16:14.678: d/dalvikvm(6173): gc_external_alloc freed 1k, 48% free 2829k/5379k, external 13363k/14068k, paused 22ms 03-08 00:16:14.779: d/dalvikvm(6173): gc_external_alloc freed <1k, 48% free 2829k/5379k, external 16457k/17091k, paused 21ms 03-08 00:16:15.037: d/androidruntime(6173): shutting down vm 03-08 00:16:15.037: w/dalvikvm(6173): threadid=1: thread exiting uncaught exception (group=0x40015578) 03-08 00:16:15.037: e/androidruntime(6173): fatal exception: main 03-08 00:16:15.037: e/androidruntime(6173): java.lang.runtimeexception: unable start activity componentinfo{izzy.n/izzy.n.main1}: java.lang.nullpointerexception 03-08 00:16:15.037: e/androidruntime(6173): @ android.app.activitythread.performlaunchactivity(activitythread.java:1651) 03-08 00:16:15.037: e/androidruntime(6173): @ android.app.activitythread.handlelaunchactivity(activitythread.java:1667) 03-08 00:16:15.037: e/androidruntime(6173): @ android.app.activitythread.access$1500(activitythread.java:117) 03-08 00:16:15.037: e/androidruntime(6173): @ android.app.activitythread$h.handlemessage(activitythread.java:935) 03-08 00:16:15.037: e/androidruntime(6173): @ android.os.handler.dispatchmessage(handler.java:99) 03-08 00:16:15.037: e/androidruntime(6173): @ android.os.looper.loop(looper.java:130) 03-08 00:16:15.037: e/androidruntime(6173): @ android.app.activitythread.main(activitythread.java:3687) 03-08 00:16:15.037: e/androidruntime(6173): @ java.lang.reflect.method.invokenative(native method) 03-08 00:16:15.037: e/androidruntime(6173): @ java.lang.reflect.method.invoke(method.java:507) 03-08 00:16:15.037: e/androidruntime(6173): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:842) 03-08 00:16:15.037: e/androidruntime(6173): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:600) 03-08 00:16:15.037: e/androidruntime(6173): @ dalvik.system.nativestart.main(native method) 03-08 00:16:15.037: e/androidruntime(6173): caused by: java.lang.nullpointerexception 03-08 00:16:15.037: e/androidruntime(6173): @ izzy.n.main1.populatecalendarspinner(main1.java:62) 03-08 00:16:15.037: e/androidruntime(6173): @ izzy.n.main1.oncreate(main1.java:52) 03-08 00:16:15.037: e/androidruntime(6173): @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1047) 03-08 00:16:15.037: e/androidruntime(6173): @ android.app.activitythread.performlaunchactivity(activitythread.java:1615) 03-08 00:16:15.037: e/androidruntime(6173): ... 11 more
here code android manifest:
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="izzy.n" android:versioncode="1" android:versionname="1.0" > <uses-sdk android:minsdkversion="10" /> <uses-permission android:name="android.permission.read_calendar"></uses-permission> <uses-permission android:name="android.permission.write_calendar"></uses-permission> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" > <activity android:name="izzy.n.izzynactivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <activity android:name="izzy.n.notes" android:label="@string/notes"></activity> <activity android:name="izzy.n.calculator" android:label="@string/calculator"></activity> <activity android:name="izzy.n.main1" android:label="@string/app_name"></activity> </application> </manifest>
and here main1.java:
class mycalendar { public string name; public string id; public mycalendar(string _name, string _id) { name = _name; id = _id; } @override public string tostring() { return name; } } public class main1 extends activity { /********************************************************************* * ui part*/ private spinner m_spinner_calender; private button m_button_add; private button m_button_add2; private button m_button_getevents; private textview m_text_event; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); /*get calendar list , populate view*/ getcalendars(); populatecalendarspinner(); populateaddbtn(); populateaddbtn2(); populatetextevent(); populategeteventsbtn(); } private void populatecalendarspinner() { m_spinner_calender = (spinner)this.findviewbyid(r.id.spinner_calendar); arrayadapter l_arrayadapter = new arrayadapter(this.getapplicationcontext(), android.r.layout.simple_spinner_item, m_calendars); l_arrayadapter.setdropdownviewresource(android.r.layout.simple_spinner_dropdown_item); m_spinner_calender.setadapter(l_arrayadapter); m_spinner_calender.setselection(0); m_spinner_calender.setonitemselectedlistener(new adapterview.onitemselectedlistener() { @override public void onitemselected(adapterview<?> p_parent, view p_view, int p_pos, long p_id) { m_selectedcalendarid = m_calendars[(int)p_id].id; } @override public void onnothingselected(adapterview<?> arg0) {} }); } private void populateaddbtn() { m_button_add = (button) this.findviewbyid(r.id.button_add); m_button_add.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { addevent(); } }); } private void populateaddbtn2() { m_button_add2 = (button) this.findviewbyid(r.id.button_add2); m_button_add2.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { addevent2(); } }); } private void populategeteventsbtn() { m_button_getevents = (button) findviewbyid(r.id.button_get_events); m_button_getevents.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { getlastthreeevents(); } }); } private void populatetextevent() { m_text_event = (textview) findviewbyid(r.id.text_event); string l_str = "title: roman10 calendar tutorial test\n" + "description: simple test calendar api\n" + "eventlocation: @home\n" + "start time:" + getdatetimestr(0) + "\n" + "end time: " + getdatetimestr(30) + "\n" + "event status: confirmed\n" + "all day: no\n" + "has alarm: yes\n"; m_text_event.settext(l_str); } /**************************************************************** * data part */ /*retrieve list of available calendars*/ private mycalendar m_calendars[]; private string m_selectedcalendarid = "0"; private void getcalendars() { string[] l_projection = new string[]{"_id", "displayname"}; uri l_calendars; if (build.version.sdk_int >= 8) { l_calendars = uri.parse("content://com.android.calendar/calendars"); } else { l_calendars = uri.parse("content://calendar/calendars"); } cursor l_managedcursor = this.managedquery(l_calendars, l_projection, null, null, null); //all calendars //cursor l_managedcursor = this.managedquery(l_calendars, l_projection, "selected=1", null, null); //active calendars if (l_managedcursor.movetofirst()) { m_calendars = new mycalendar[l_managedcursor.getcount()]; string l_calname; string l_calid; int l_cnt = 0; int l_namecol = l_managedcursor.getcolumnindex(l_projection[1]); int l_idcol = l_managedcursor.getcolumnindex(l_projection[0]); { l_calname = l_managedcursor.getstring(l_namecol); l_calid = l_managedcursor.getstring(l_idcol); m_calendars[l_cnt] = new mycalendar(l_calname, l_calid); ++l_cnt; } while (l_managedcursor.movetonext()); } } /*add event calendar*/ private void addevent() { contentvalues l_event = new contentvalues(); l_event.put("calendar_id", m_selectedcalendarid); l_event.put("title", "roman10 calendar tutorial test"); l_event.put("description", "this simple test calendar api"); l_event.put("eventlocation", "@home"); l_event.put("dtstart", system.currenttimemillis()); l_event.put("dtend", system.currenttimemillis() + 1800*1000); l_event.put("allday", 0); //status: 0~ tentative; 1~ confirmed; 2~ canceled l_event.put("eventstatus", 1); //0~ default; 1~ confidential; 2~ private; 3~ public l_event.put("visibility", 0); //0~ opaque, no timing conflict allowed; 1~ transparency, allow overlap of scheduling l_event.put("transparency", 0); //0~ false; 1~ true l_event.put("hasalarm", 1); uri l_eventuri; if (build.version.sdk_int >= 8) { l_eventuri = uri.parse("content://com.android.calendar/events"); } else { l_eventuri = uri.parse("content://calendar/events"); } uri l_uri = this.getcontentresolver().insert(l_eventuri, l_event); log.v("++++++test", l_uri.tostring()); } /*add event through intent, doesn't require permission * send intent android calendar * http://www.openintents.org/en/uris*/ private void addevent2() { intent l_intent = new intent(intent.action_edit); l_intent.settype("vnd.android.cursor.item/event"); //l_intent.putextra("calendar_id", m_selectedcalendarid); //this doesn't work l_intent.putextra("title", "roman10 calendar tutorial test"); l_intent.putextra("description", "this simple test calendar api"); l_intent.putextra("eventlocation", "@home"); l_intent.putextra("begintime", system.currenttimemillis()); l_intent.putextra("endtime", system.currenttimemillis() + 1800*1000); l_intent.putextra("allday", 0); //status: 0~ tentative; 1~ confirmed; 2~ canceled l_intent.putextra("eventstatus", 1); //0~ default; 1~ confidential; 2~ private; 3~ public l_intent.putextra("visibility", 0); //0~ opaque, no timing conflict allowed; 1~ transparency, allow overlap of scheduling l_intent.putextra("transparency", 0); //0~ false; 1~ true l_intent.putextra("hasalarm", 1); try { startactivity(l_intent); } catch (exception e) { toast.maketext(this.getapplicationcontext(), "sorry, no compatible calendar found!", toast.length_long).show(); } } /*get list of events * http://jimblackler.net/blog/?p=151*/ private void getlastthreeevents() { uri l_eventuri; if (build.version.sdk_int >= 8) { l_eventuri = uri.parse("content://com.android.calendar/events"); } else { l_eventuri = uri.parse("content://calendar/events"); } string[] l_projection = new string[]{"title", "dtstart", "dtend"}; cursor l_managedcursor = this.managedquery(l_eventuri, l_projection, "calendar_id=" + m_selectedcalendarid, null, "dtstart desc, dtend desc"); //cursor l_managedcursor = this.managedquery(l_eventuri, l_projection, null, null, null); if (l_managedcursor.movetofirst()) { int l_cnt = 0; string l_title; string l_begin; string l_end; stringbuilder l_displaytext = new stringbuilder(); int l_coltitle = l_managedcursor.getcolumnindex(l_projection[0]); int l_colbegin = l_managedcursor.getcolumnindex(l_projection[1]); int l_colend = l_managedcursor.getcolumnindex(l_projection[1]); { l_title = l_managedcursor.getstring(l_coltitle); l_begin = getdatetimestr(l_managedcursor.getstring(l_colbegin)); l_end = getdatetimestr(l_managedcursor.getstring(l_colend)); l_displaytext.append(l_title + "\n" + l_begin + "\n" + l_end + "\n----------------\n"); ++l_cnt; } while (l_managedcursor.movetonext() && l_cnt < 3); m_text_event.settext(l_displaytext.tostring()); } } /************************************************ * utility part */ private static final string date_time_format = "yyyy mmm dd, hh:mm:ss"; public static string getdatetimestr(int p_delay_min) { calendar cal = calendar.getinstance(); simpledateformat sdf = new simpledateformat(date_time_format); if (p_delay_min == 0) { return sdf.format(cal.gettime()); } else { date l_time = cal.gettime(); l_time.setminutes(l_time.getminutes() + p_delay_min); return sdf.format(l_time); } } public static string getdatetimestr(string p_time_in_millis) { simpledateformat sdf = new simpledateformat(date_time_format); date l_time = new date(long.parselong(p_time_in_millis)); return sdf.format(l_time); } }
fix this:
03-07 23:50:41.933: e/androidruntime(5553): android.content.activitynotfoundexception: unable find explicit activity class {izzy.n/izzy.n.main1}; have declared activity in androidmanifest.xml?
also
point out line complaining about.
Comments
Post a Comment