The error, is Null Pointer exception and the error, is in
maintemp.java file, Line number 31..

I got these information from these lines of the logcat..

E/AndroidRuntime(  868): Caused by: java.lang.NullPointerException
E/AndroidRuntime(  868):        at
com.example.myfirstapp.maintemp.<init>
(maintemp.java:31)

The error is due to you have to declare all the essential components
of the Android application in manifest file like, Acitivity, service,
Broadcast receiver, content provider.

Here, You are telling, you have two acivities and declaring only one
activity in the manifest file.



Thanks





On Nov 24, 9:51 am, wahib <[email protected]> wrote:
> I have two activities. My AndroidManifest.xml file is like this ...
>
> <?xml version="1.0" encoding="utf-8"?>
> <manifest xmlns:android="http://schemas.android.com/apk/res/android";
>       package="com.example.myfirstapp"
>       android:versionCode="1"
>       android:versionName="1.0">
>       <uses-permission android:name="android.permission.CAMERA"></uses-
> permission>
>     <application android:icon="@drawable/icon" android:label="@string/
> app_name">
>
>      <activity android:name=".myfirstapp"
>                   android:label="@string/app_name">
>
>         </activity>
>      <activity android:name=".maintemp"
>                   android:label="@string/app_name">
>             <intent-filter>
>                 <action android:name="android.intent.action.MAIN" />
>                 <category
> android:name="android.intent.category.LAUNCHER" />
>             </intent-filter>
>
>         </activity>
>
>     </application>
>     <uses-sdk android:minSdkVersion="4" />
> </manifest>
>
> but when i run error occurs and in logcat these details of error are
> displayed. Being a newbie its tough to solve it.
>
> I/ActivityManager(  580): Starting activity: Intent
> { act=android.intent.action.MAIN cat=
> [android.intent.category.LAUNCHER] flg=0x10200000
> cmp=com.example.myfirstapp/.maintemp }
> I/ActivityManager(  580): Start proc com.example.myfirstapp for
> activity com.example.myfirstapp/.maintemp: pid=868 uid=10029 gids=
> {1006}
> I/jdwp    (  868): received file descriptor 20 from ADB
> D/AndroidRuntime(  868): Shutting down VM
> W/dalvikvm(  868): threadid=3: thread exiting with uncaught exception
> (group=0x4001aa28)
> E/AndroidRuntime(  868): Uncaught handler: thread main exiting due to
> uncaught exception
> E/AndroidRuntime(  868): java.lang.RuntimeException: Unable to
> instantiate activity ComponentInfo{com.example.myfirstapp/
> com.example.myfirstapp.maintemp}: java.lang.NullPointerException
> E/AndroidRuntime(  868):        at
> android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
> 2324)
> E/AndroidRuntime(  868):        at
> android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
> 2417)
> E/AndroidRuntime(  868):        at android.app.ActivityThread.access$2100
> (ActivityThread.java:116)
> E/AndroidRuntime(  868):        at android.app.ActivityThread$H.handleMessage
> (ActivityThread.java:1794)
> E/AndroidRuntime(  868):        at android.os.Handler.dispatchMessage
> (Handler.java:99)
> E/AndroidRuntime(  868):        at android.os.Looper.loop(Looper.java:123)
> E/AndroidRuntime(  868):        at android.app.ActivityThread.main
> (ActivityThread.java:4203)
> E/AndroidRuntime(  868):        at java.lang.reflect.Method.invokeNative
> (Native Method)
> E/AndroidRuntime(  868):        at java.lang.reflect.Method.invoke
> (Method.java:521)
> E/AndroidRuntime(  868):        at com.android.internal.os.ZygoteInit
> $MethodAndArgsCaller.run(ZygoteInit.java:791)
> E/AndroidRuntime(  868):        at com.android.internal.os.ZygoteInit.main
> (ZygoteInit.java:549)
> E/AndroidRuntime(  868):        at dalvik.system.NativeStart.main(Native
> Method)
> E/AndroidRuntime(  868): Caused by: java.lang.NullPointerException
> E/AndroidRuntime(  868):        at android.app.Activity.findViewById
> (Activity.java:1610)
> E/AndroidRuntime(  868):        at com.example.myfirstapp.maintemp.<init>
> (maintemp.java:31)
> E/AndroidRuntime(  868):        at java.lang.Class.newInstanceImpl(Native
> Method)
> E/AndroidRuntime(  868):        at java.lang.Class.newInstance(Class.java:
> 1472)
> E/AndroidRuntime(  868):        at android.app.Instrumentation.newActivity
> (Instrumentation.java:1097)
> E/AndroidRuntime(  868):        at
> android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
> 2316)
>
> Thanks in advance.
> regards,
> wahib

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to