Android (Java) Learning Note 123:clock App write error

Source: Internet
Author: User

1. First of all we apart directly read the wrong content as follows:

07-12 08:25:03.572:E/DALVIKVM (3602):nativeFork pid:0Done .07-12 08:25:03.582:E/DALVIKVM (3602): threadid=6:created from Interp,name=Referencequeuedaemon07-12 08:25:03.582:E/DALVIKVM (3602): threadid=6:calling run (), name=Referencequeuedaemon07-12 08:25:03.582:E/DALVIKVM (3602): threadid=7:created from Interp,name=Finalizerdaemon07-12 08:25:03.582:E/DALVIKVM (3602): threadid=7:calling run (), name=Finalizerdaemon07-12 08:25:03.592:E/DALVIKVM (3602): threadid=8:created from Interp,name=Finalizerwatchdogdaemon07-12 08:25:03.592:E/DALVIKVM (3602): threadid=8:calling run (), name=Finalizerwatchdogdaemon07-12 08:25:03.642:d/activitythread (3602): settargetheaputilization:0.2507-12 08:25:03.642:d/activitythread (3602) : settargetheapidealfree:838860807-12 08:25:03.642:d/activitythread (3602): Settargetheapconcurrentstart : 209715207-12 08:25:03.662:i/system.out (3602): Sending WAIT Chunk07-12 08:25:03.662:w/activitythread (3602): Application Com.himi.clock is waiting forThe debugger on port 8100...07-12 08:25:05.253:i/system.out (3602): Debugger has connected07-12 08:25:05.253:i/system.out (3602): Waiting fordebugger to settle ...07-12 08:25:05.454:i/system.out (3602): Waiting fordebugger to settle ...07-12 08:25:05.654:i/system.out (3602): Waiting fordebugger to settle ...07-12 08:25:05.854:i/system.out (3602): Waiting fordebugger to settle ...07-12 08:25:06.054:i/system.out (3602): Waiting fordebugger to settle ...07-12 08:25:06.254:i/system.out (3602): Waiting fordebugger to settle ...07-12 08:25:06.455:i/system.out (3602): Waiting fordebugger to settle ...07-12 08:25:06.655:i/system.out (3602): Waiting fordebugger to settle ...07-12 08:25:06.855:i/system.out (3602): Waiting fordebugger to settle ...07-12 08:25:07.055:i/system.out (3602): Waiting fordebugger to settle ...07-12 08:25:07.256:i/system.out (3602): Debugger has settled (1411)07-12 08:26:55.171:d/activitythread (4159): settargetheaputilization:0.2507-12 08:26:55.171:d/activitythread (4159) : settargetheapidealfree:838860807-12 08:26:55.171:d/activitythread (4159): Settargetheapconcurrentstart : 209715207-12 08:26:55.391:W/DALVIKVM (4159): Threadid=1:thread exiting with uncaught exception (group=0x416cd498)07-12 08:26:55.391:e/androidruntime (4159): FATAL exception:main07-12 08:26:55.391:e/androidruntime (4159): java.lang.RuntimeException:Unable to start activity componentinfo{ Com.himi.clock/com.himi.clock.mainactivity}: Android.content.ActivityNotFoundException:Unable to find explicit Activityclass{com.himi.clock/com.himi.clock.clockactivity}; Have your declared ThisActivity in your androidmanifest.xml?07-12 08:26:55.391:e/androidruntime (4159): at Android.app.ActivityThread.perfor Mlaunchactivity (activitythread.java:2092)07-12 08:26:55.391:e/androidruntime (4159): at Android.app.ActivityThread.handleLaunchActivity (Activitythread.java : 2117)07-12 08:26:55.391:e/androidruntime (4159): at android.app.activitythread.access$600 (ActivityThread.java:140)07-12 08:26:55.391:e/androidruntime (4159): at Android.app.activitythread$h.handlemessage (ActivityThread.java:1213)07-12 08:26:55.391:e/androidruntime (4159): at Android.os.Handler.dispatchMessage (handler.java:99)07-12 08:26:55.391:e/androidruntime (4159): at Android.os.Looper.loop (looper.java:137)07-12 08:26:55.391:e/androidruntime (4159): at Android.app.ActivityThread.main (activitythread.java:4914)07-12 08:26:55.391:e/androidruntime (4159): At Java.lang.reflect.Method.invokeNative (Native Method)07-12 08:26:55.391:e/androidruntime (4159): at Java.lang.reflect.Method.invoke (method.java:511)07-12 08:26:55.391:e/androidruntime (4159): at Com.android.internal.os.zygoteinit$methodandargscaller.run ( zygoteinit.java:808)07-12 08:26:55.391:e/androidruntime (4159): at Com.android.internal.os.ZygoteInit.main (zygoteinit.java:575)07-12 08:26:55.391:e/androidruntime (4159): At Dalvik.system.NativeStart.main (Native Method)07-12 08:26:55.391:e/androidruntime (4159): caused By:android.content.ActivityNotFoundException:Unable to find Explicit activityclass{com.himi.clock/com.himi.clock.clockactivity}; Have your declared ThisActivity in your androidmanifest.xml?07-12 08:26:55.391:e/androidruntime (4159): at Android.app.Instrumentation.check Startactivityresult (instrumentation.java:1541)07-12 08:26:55.391:e/androidruntime (4159): at Android.app.ActivityThread.resolveActivityInfo (Activitythread.java : 1903)07-12 08:26:55.391:e/androidruntime (4159): at Android.app.LocalActivityManager.startActivity ( localactivitymanager.java:285)07-12 08:26:55.391:e/androidruntime (4159): at Android.widget.tabhost$intentcontentstrategy.getcontentview ( tabhost.java:694)07-12 08:26:55.391:e/androidruntime (4159): at Android.widget.TabHost.setCurrentTab (tabhost.java:358)07-12 08:26:55.391:e/androidruntime (4159): at Android.widget.TabHost.addTab (tabhost.java:236)07-12 08:26:55.391:e/androidruntime (4159): at Com.himi.clock.MainActivity.addOneTab (mainactivity.java:32)07-12 08:26:55.391:e/androidruntime (4159): at Com.himi.clock.MainActivity.onCreate (mainactivity.java:20)07-12 08:26:55.391:e/androidruntime (4159): at Android.app.Activity.performCreate (activity.java:5086)07-12 08:26:55.391:e/androidruntime (4159): at Android.app.Instrumentation.callActivityOnCreate ( instrumentation.java:1079)07-12 08:26:55.391:e/androidruntime (4159): At Com.lbe.security.service.core.client.b.x.callactivityoncreate (Unknown Source)07-12 08:26:55.391:e/androidruntime (4159): at Android.app.ActivityThread.performLaunchActivity ( activitythread.java:2056)07-12 08:26:55.391:e/androidruntime (4159): ... 11 More07-12 08:34:04.128:d/activitythread (6074): settargetheaputilization:0.2507-12 08:34:04.128:d/activitythread (6074) : settargetheapidealfree:838860807-12 08:34:04.128:d/activitythread (6074): Settargetheapconcurrentstart : 209715207-12 08:34:04.379:W/DALVIKVM (6074): Threadid=1:thread exiting with uncaught exception (group=0x416cd498)07-12 08:34:04.389:e/androidruntime (6074): FATAL exception:main07-12 08:34:04.389:e/androidruntime (6074):java.lang.RuntimeException:Unable to start activity componentinfo{com.himi.clock/com.himi.clock.mainactivity}: Android.content.ActivityNotFoundException:Unable to find explicit activity class {com.himi.clock/ Com.himi.clock.ClockActivity}; Declared this activity in your androidmanifest.xml?07-12 08:34:04.389:e/androidruntime (6074): at Android.app.ActivityThread.performLaunchActivity ( activitythread.java:2092)07-12 08:34:04.389:e/androidruntime (6074): at Android.app.ActivityThread.handleLaunchActivity (Activitythread.java : 2117)07-12 08:34:04.389:e/androidruntime (6074): at android.app.activitythread.access$600 (ActivityThread.java:140)07-12 08:34:04.389:e/androidruntime (6074): at Android.app.activitythread$h.handlemessage (ActivityThread.java:1213)07-12 08:34:04.389:e/androidruntime (6074): at Android.os.Handler.dispatchMessage (handler.java:99)07-12 08:34:04.389:e/androidruntime (6074): at Android.os.Looper.loop (looper.java:137)07-12 08:34:04.389:e/androidruntime (6074): at Android.app.ActivityThread.main (activitythread.java:4914)07-12 08:34:04.389:e/androidruntime (6074): At Java.lang.reflect.Method.invokeNative (Native Method)07-12 08:34:04.389:e/androidruntime (6074): at Java.lang.reflect.Method.invoke (method.java:511)07-12 08:34:04.389:e/androidruntime (6074): at Com.android.internal.os.zygoteinit$methodandargscaller.run ( zygoteinit.java:808)07-12 08:34:04.389:e/androidruntime (6074): at Com.android.internal.os.ZygoteInit.main (zygoteinit.java:575)07-12 08:34:04.389:e/androidruntime (6074): At Dalvik.system.NativeStart.main (Native Method)07-12 08:34:04.389:e/androidruntime (6074):caused By:android.content.ActivityNotFoundException:Unable to find explicit activity class {com.himi.clock/ Com.himi.clock.ClockActivity}; Declared this activity in your androidmanifest.xml?07-12 08:34:04.389:e/androidruntime (6074): at Android.app.Instrumentation.checkStartActivityResult ( instrumentation.java:1541)07-12 08:34:04.389:e/androidruntime (6074): at Android.app.ActivityThread.resolveActivityInfo (Activitythread.java : 1903)07-12 08:34:04.389:e/androidruntime (6074): at Android.app.LocalActivityManager.startActivity ( localactivitymanager.java:285)07-12 08:34:04.389:e/androidruntime (6074): at Android.widget.tabhost$intentcontentstrategy.getcontentview ( tabhost.java:694)07-12 08:34:04.389:e/androidruntime (6074): at Android.widget.TabHost.setCurrentTab (tabhost.java:358)07-12 08:34:04.389:e/androidruntime (6074): at Android.widget.TabHost.addTab (tabhost.java:236)07-12 08:34:04.389:e/androidruntime (6074): at Com.himi.clock.MainActivity.addOneTab (mainactivity.java:32)07-12 08:34:04.389:e/androidruntime (6074): at Com.himi.clock.MainActivity.onCreate (mainactivity.java:20)07-12 08:34:04.389:e/androidruntime (6074): at Android.app.Activity.performCreate (activity.java:5086)07-12 08:34:04.389:e/androidruntime (6074): at Android.app.Instrumentation.callActivityOnCreate ( instrumentation.java:1079)07-12 08:34:04.389:e/androidruntime (6074): At Com.lbe.security.service.core.client.b.x.callactivityoncreate (Unknown Source)07-12 08:34:04.389:e/androidruntime (6074): at Android.app.ActivityThread.performLaunchActivity ( activitythread.java:2056)07-12 08:34:04.389:e/androidruntime (6074): ... One more

Read the error message in the red font carefully to know: Originally I wrote the app contains a number of activity, must be declared in the Androidmanifest.xml, declared as follows:

<?xml version= "1.0" encoding= "Utf-8"? ><manifest xmlns:android= "Http://schemas.android.com/apk/res/android" Package= "Com.himi.clock"Android:versioncode= "1"Android:versionname= "1.0" > <uses-SDK Android:minsdkversion= "15"android:targetsdkversion= "/>" <Application Android:allowbackup= "true"Android:icon= "@drawable/ic_launcher"Android:label= "@string/app_name"Android:theme= "@style/apptheme" > <Activity Android:name=". Mainactivity "Android:label= "@string/app_name" > <intent-filter> <action android:name= "Android.intent.action.MA In "/> <category android:name=" Android.intent.category.LAUNCHER "/> </intent-filter&        Gt </activity><activity android:name= ". Clockactivity "/> <activity android:name=". Stopwatchactivity "/> <activity android:name=". Timeractivity "/></application></manifest>

Loading the program into the phone again, found that this time can be run, no error

So why do you register multiple activity in Androidmanifest.xml declaration???

A: We know that different activity represents a different window interface, the Android system only has to register the different activity, the internal system can operate on it, such as using intent operation.

Android (Java) Learning Note 123:clock App write error

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.