I tried to run my app, but it is crashing before reaching the onCreate() method. I'm new to android and eclipse, so i do not even know where to start searching for the error.
That's the Error Message form LogCat:
11-22 21:06:59.787: WARN/dalvikvm(433): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
11-22 21:07:01.468: ERROR/AndroidRuntime(433): FATAL EXCEPTION: main
11-22 21:07:01.468: ERROR/AndroidRuntime(433): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.app/com.example.app.HelloActivity}: java.lang.NullPointerException
11-22 21:07:01.468: ERROR/AndroidRuntime(433): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
11-22 21:07:01.468: ERROR/AndroidRuntime(433): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
11-22 21:07:01.468: ERROR/AndroidRuntime(433): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
11-22 21:07:01.468: ERROR/AndroidRuntime(433): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
11-22 21:07:01.468: ERROR/AndroidRuntime(433): at android.os.Handler.dispatchMessage(Handler.java:99)
11-22 21:07:01.468: ERROR/AndroidRuntime(433): at android.os.Looper.loop(Looper.java:123)
11-22 21:07:01.468: ERROR/AndroidRuntime(433): at android.app.ActivityThread.main(ActivityThread.java:4627)
11-22 21:07:01.468: ERROR/AndroidRuntime(433): at java.lang.reflect.Method.invokeNative(Native Method)
11-22 21:07:01.468: ERROR/AndroidRuntime(433): at java.lang.reflect.Method.invoke(Method.java:521)
11-22 21:07:01.468: ERROR/AndroidRuntime(433): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
11-22 21:07:01.468: ERROR/AndroidRuntime(433): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
11-22 21:07:01.468: ERROR/AndroidRuntime(433): at dalvik.system.NativeStart.main(Native Method)
11-22 21:07:01.468: ERROR/AndroidRuntime(433): Caused by: java.lang.NullPointerException
11-22 21:07:01.468: ERROR/AndroidRuntime(433): at android.content.ContextWrapper.getSharedPreferences(ContextWrapper.java:146)
11-22 21:07:01.468: ERROR/AndroidRuntime(433): at com.example.app.HelloActivity.<init>(HelloActivity.java:51)
11-22 21:07:01.468: ERROR/AndroidRuntime(433): at java.lang.Class.newInstanceImpl(Native Method)
11-22 21:07:01.468: ERROR/AndroidRuntime(433): at java.lang.Class.newInstance(Class.java:1429)
11-22 21:07:01.468: ERROR/AndroidRuntime(433): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
11-22 21:07:01.468: ERROR/AndroidRuntime(433): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
11-22 21:07:01.468: ERROR/AndroidRuntime(433): ... 11 more
From what i can say from the logcat (the code would help to make this even clearer), you wrote something in the constructor.
This is bad practice unless you exactly know what you are doing(but i think yours is just a first-timer error ;) ).
You should do everything to initialize your app in the overridden onCreate method.
Try not to create any constructor, and move everything in the onCreate method.
And remember, activities doesn't have a main function, and you can't pass arguments to them(there are special classes to pass data between activities)
EDIT:
now that i look better at your logcat, i can tell you even more.
You are using sharedPreferences in the constructor, but when the constructor is called, the activity doesn't exist yet, so it doesn't have any prederenceManager. This is why you get a null pointer. As i said, moving everything in the onCreate method will solve your problem
Related
I want to add support for my app to the Android Foryo.
But I cannot seem to figure the problem out. I have done many research using Google and in StackOverflow. The only thing I got is that I have to use <android.support.v4.app.fragment instead of <fragment using the support library, but that is also doesn't work!
Whenever I try to run the application it crushes and I get this error in the LogCat.
android.view.InflateException: Binary XML file line #40: Error inflating class android.support.v4.app.fragment
XML
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TabHost
android:id="#android:id/tabhost"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:id="#+id/LinearLayout01"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TabWidget
android:id="#android:id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</TabWidget>
<FrameLayout
android:id="#android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</FrameLayout>
</LinearLayout>
</TabHost>
<LinearLayout
android:id="#+id/settings_fragment_layout"
android:layout_width="280dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#FFffffff"
android:orientation="vertical" >
<android.support.v4.app.fragment
android:id="#+id/settings_fragment_section"
android:name="com.example.SettingsFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</android.support.v4.widget.DrawerLayout>
Java
/**
*
*/
package com.example;
import android.app.TabActivity;
import android.os.Bundle;
/**
* #author
*
*/
public class MainActivity extends TabActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
SettingsFragment.java
It's just...
package com.example;
import android.os.Bundle;
import com.nozzha.support.v4.preference.PreferenceFragment;
public class SettingsFragment extends PreferenceFragment {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preference_settings);
}
}
LogCat
11-22 11:19:54.141: E/AndroidRuntime(1197): FATAL EXCEPTION: main
11-22 11:19:54.141: E/AndroidRuntime(1197): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example/com.example.MainActivity}: android.view.InflateException: Binary XML file line #40: Error inflating class android.support.v4.app.fragment
11-22 11:19:54.141: E/AndroidRuntime(1197): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
11-22 11:19:54.141: E/AndroidRuntime(1197): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
11-22 11:19:54.141: E/AndroidRuntime(1197): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
11-22 11:19:54.141: E/AndroidRuntime(1197): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
11-22 11:19:54.141: E/AndroidRuntime(1197): at android.os.Handler.dispatchMessage(Handler.java:99)
11-22 11:19:54.141: E/AndroidRuntime(1197): at android.os.Looper.loop(Looper.java:123)
11-22 11:19:54.141: E/AndroidRuntime(1197): at android.app.ActivityThread.main(ActivityThread.java:4627)
11-22 11:19:54.141: E/AndroidRuntime(1197): at java.lang.reflect.Method.invokeNative(Native Method)
11-22 11:19:54.141: E/AndroidRuntime(1197): at java.lang.reflect.Method.invoke(Method.java:521)
11-22 11:19:54.141: E/AndroidRuntime(1197): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
11-22 11:19:54.141: E/AndroidRuntime(1197): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
11-22 11:19:54.141: E/AndroidRuntime(1197): at dalvik.system.NativeStart.main(Native Method)
11-22 11:19:54.141: E/AndroidRuntime(1197): Caused by: android.view.InflateException: Binary XML file line #40: Error inflating class android.support.v4.app.fragment
11-22 11:19:54.141: E/AndroidRuntime(1197): at android.view.LayoutInflater.createView(LayoutInflater.java:503)
11-22 11:19:54.141: E/AndroidRuntime(1197): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
11-22 11:19:54.141: E/AndroidRuntime(1197): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
11-22 11:19:54.141: E/AndroidRuntime(1197): at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
11-22 11:19:54.141: E/AndroidRuntime(1197): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
11-22 11:19:54.141: E/AndroidRuntime(1197): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
11-22 11:19:54.141: E/AndroidRuntime(1197): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
11-22 11:19:54.141: E/AndroidRuntime(1197): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
11-22 11:19:54.141: E/AndroidRuntime(1197): at android.app.Activity.setContentView(Activity.java:1647)
11-22 11:19:54.141: E/AndroidRuntime(1197): at com.example.MainActivity.onCreate(MainActivity.java:19)
11-22 11:19:54.141: E/AndroidRuntime(1197): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
11-22 11:19:54.141: E/AndroidRuntime(1197): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
11-22 11:19:54.141: E/AndroidRuntime(1197): ... 11 more
11-22 11:19:54.141: E/AndroidRuntime(1197): Caused by: java.lang.NoSuchMethodException: fragment(Context,AttributeSet)
11-22 11:19:54.141: E/AndroidRuntime(1197): at java.lang.Class.getMatchingConstructor(Class.java:660)
11-22 11:19:54.141: E/AndroidRuntime(1197): at java.lang.Class.getConstructor(Class.java:477)
11-22 11:19:54.141: E/AndroidRuntime(1197): at android.view.LayoutInflater.createView(LayoutInflater.java:475)
11-22 11:19:54.141: E/AndroidRuntime(1197): ... 22 more
That is because your Activity does not extend the base Activity FragmentActivity. If you use Support Based Fragment, then your Activity must extend the FragmentActivity.
http://developer.android.com/reference/android/support/v4/app/FragmentActivity.html
please try adding the constructor. public void SettingsFragment(){}. Activity needs it to properly initialize the fragment.
15 reports
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.oas.fruitkungfufree/com.openfeint.internal.ui.IntroFlow}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
at android.app.ActivityThread.access$2300(ActivityThread.java:125)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at com.openfeint.internal.Util.setOrientation(Util.java:36)
at com.openfeint.internal.ui.NestedWindow.onCreate(NestedWindow.java:32)
at com.openfeint.internal.ui.WebNav.onCreate(WebNav.java:93)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
Does any one have a solution for this??
This is a problem with your code, you can't use an object that is null. This is a hint.
I'm trying to use the following to create a Spinner. But I get NullPointerException at line
Register.registerlist.setAdapter(spinnernamelist);
Can anyone help me? Thank you.
ArrayAdapter<String> spinnernamelist= new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item, Register.namelist);
spinnernamelist.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
Register.registerlist=(Spinner)findViewById(R.id.showlist);
Register.registerlist.setAdapter(spinnernamelist);
My Logcat output -
11-22 07:43:30.881: E/AndroidRuntime(1200): java.lang.IllegalStateException: Could not execute method of the activity
11-22 07:43:30.881: E/AndroidRuntime(1200): at android.view.View$1.onClick(View.java:3019)
11-22 07:43:30.881: E/AndroidRuntime(1200): at android.view.View.performClick(View.java:3460)
11-22 07:43:30.881: E/AndroidRuntime(1200): at android.view.View$PerformClick.run(View.java:13955)
11-22 07:43:30.881: E/AndroidRuntime(1200): at android.os.Handler.handleCallback(Handler.java:605)
11-22 07:43:30.881: E/AndroidRuntime(1200): at android.os.Handler.dispatchMessage(Handler.java:92)
11-22 07:43:30.881: E/AndroidRuntime(1200): at android.os.Looper.loop(Looper.java:137)
11-22 07:43:30.881: E/AndroidRuntime(1200): at android.app.ActivityThread.main(ActivityThread.java:4340)
11-22 07:43:30.881: E/AndroidRuntime(1200): at java.lang.reflect.Method.invokeNative(Native Method)
11-22 07:43:30.881: E/AndroidRuntime(1200): at java.lang.reflect.Method.invoke(Method.java:511)
11-22 07:43:30.881: E/AndroidRuntime(1200): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
11-22 07:43:30.881: E/AndroidRuntime(1200): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
11-22 07:43:30.881: E/AndroidRuntime(1200): at dalvik.system.NativeStart.main(Native Method)
11-22 07:43:30.881: E/AndroidRuntime(1200): Caused by: java.lang.reflect.InvocationTargetException
11-22 07:43:30.881: E/AndroidRuntime(1200): at java.lang.reflect.Method.invokeNative(Native Method)
11-22 07:43:30.881: E/AndroidRuntime(1200): at java.lang.reflect.Method.invoke(Method.java:511)
11-22 07:43:30.881: E/AndroidRuntime(1200): at android.view.View$1.onClick(View.java:3014)
11-22 07:43:30.881: E/AndroidRuntime(1200): ... 11 more
11-22 07:43:30.881: E/AndroidRuntime(1200): Caused by: java.lang.NullPointerException
11-22 07:43:30.881: E/AndroidRuntime(1200): at Picture.Capture.Register.callPictureTake(Register.java:56)
Very likely that Register.registerlist is null and you get a null pointer exception when you try to run a method on it.
So check if Register.registerlist is correctly initialized
spinnernamelist obviously isn't null, so Register.registerlist has to be null. findViewById(...) will return null if it does not find a view with that identifier in the parent layout of the Activity. Make sure the ID you are referencing is indeed in the Activity you are calling it from.
Hello all i have an app it works fine on API 8 but i need it to work on API 7 2.1. the app launches but when i click the button on the spalsh screen to go into the app it force closes on me.
I am using the kankan wheel project if that is any help?
Also i go this from LogCat:
11-22 11:36:53.591: D/ddm-heap(3356): Got feature list request
11-22 11:36:54.071: D/dalvikvm(3356): GC freed 723 objects / 53872 bytes in 247ms
11-22 11:36:54.461: D/dalvikvm(3356): GC freed 225 objects / 10080 bytes in 55ms
11-22 11:37:02.881: D/dalvikvm(3356): GC freed 243 objects / 18368 bytes in 62ms
11-22 11:37:03.121: D/AndroidRuntime(3356): Shutting down VM
11-22 11:37:03.121: W/dalvikvm(3356): threadid=3: thread exiting with uncaught exception (group=0x40026160)
11-22 11:37:03.121: E/AndroidRuntime(3356): Uncaught handler: thread main exiting due to uncaught exception
11-22 11:37:03.121: E/AndroidRuntime(3356): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.insult.kp/kankan.wheel.demo.PasswActivity}: java.lang.ClassCastException: android.widget.ImageView
11-22 11:37:03.121: E/AndroidRuntime(3356): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2503)
11-22 11:37:03.121: E/AndroidRuntime(3356): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2519)
11-22 11:37:03.121: E/AndroidRuntime(3356): at android.app.ActivityThread.access$2200(ActivityThread.java:123)
11-22 11:37:03.121: E/AndroidRuntime(3356): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1870)
11-22 11:37:03.121: E/AndroidRuntime(3356): at android.os.Handler.dispatchMessage(Handler.java:99)
11-22 11:37:03.121: E/AndroidRuntime(3356): at android.os.Looper.loop(Looper.java:123)
11-22 11:37:03.121: E/AndroidRuntime(3356): at android.app.ActivityThread.main(ActivityThread.java:4370)
11-22 11:37:03.121: E/AndroidRuntime(3356): at java.lang.reflect.Method.invokeNative(Native Method)
11-22 11:37:03.121: E/AndroidRuntime(3356): at java.lang.reflect.Method.invoke(Method.java:521)
11-22 11:37:03.121: E/AndroidRuntime(3356): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
11-22 11:37:03.121: E/AndroidRuntime(3356): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
11-22 11:37:03.121: E/AndroidRuntime(3356): at dalvik.system.NativeStart.main(Native Method)
11-22 11:37:03.121: E/AndroidRuntime(3356): Caused by: java.lang.ClassCastException: android.widget.ImageView
11-22 11:37:03.121: E/AndroidRuntime(3356): at kankan.wheel.demo.PasswActivity.onCreate(PasswActivity.java:72)
11-22 11:37:03.121: E/AndroidRuntime(3356): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
11-22 11:37:03.121: E/AndroidRuntime(3356): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2466)
11-22 11:37:03.121: E/AndroidRuntime(3356): ... 11 more
11-22 11:37:03.131: E/SemcCheckin(3356): Get crash dump level : java.io.FileNotFoundException: /data/semc-checkin/crashdump
11-22 11:37:03.141: I/dalvikvm(3356): threadid=7: reacting to signal 3
11-22 11:37:03.151: I/dalvikvm(3356): Wrote stack trace to '/data/anr/traces.txt'
11-22 11:37:04.631: D/dalvikvm(3376): GC freed 760 objects / 55296 bytes in 78ms
11-22 11:37:04.841: D/dalvikvm(3376): GC freed 235 objects / 10552 bytes in 56ms
11-22 11:37:05.181: D/dalvikvm(3376): GC freed 337 objects / 24144 bytes in 58ms
11-22 11:37:05.421: D/AndroidRuntime(3376): Shutting down VM
11-22 11:37:05.421: W/dalvikvm(3376): threadid=3: thread exiting with uncaught exception (group=0x40026160)
11-22 11:37:05.421: E/AndroidRuntime(3376): Uncaught handler: thread main exiting due to uncaught exception
11-22 11:37:05.421: E/AndroidRuntime(3376): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.insult.kp/kankan.wheel.demo.PasswActivity}: java.lang.ClassCastException: android.widget.ImageView
11-22 11:37:05.421: E/AndroidRuntime(3376): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2503)
11-22 11:37:05.421: E/AndroidRuntime(3376): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2519)
11-22 11:37:05.421: E/AndroidRuntime(3376): at android.app.ActivityThread.access$2200(ActivityThread.java:123)
11-22 11:37:05.421: E/AndroidRuntime(3376): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1870)
11-22 11:37:05.421: E/AndroidRuntime(3376): at android.os.Handler.dispatchMessage(Handler.java:99)
11-22 11:37:05.421: E/AndroidRuntime(3376): at android.os.Looper.loop(Looper.java:123)
11-22 11:37:05.421: E/AndroidRuntime(3376): at android.app.ActivityThread.main(ActivityThread.java:4370)
11-22 11:37:05.421: E/AndroidRuntime(3376): at java.lang.reflect.Method.invokeNative(Native Method)
11-22 11:37:05.421: E/AndroidRuntime(3376): at java.lang.reflect.Method.invoke(Method.java:521)
11-22 11:37:05.421: E/AndroidRuntime(3376): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
11-22 11:37:05.421: E/AndroidRuntime(3376): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
11-22 11:37:05.421: E/AndroidRuntime(3376): at dalvik.system.NativeStart.main(Native Method)
11-22 11:37:05.421: E/AndroidRuntime(3376): Caused by: java.lang.ClassCastException: android.widget.ImageView
11-22 11:37:05.421: E/AndroidRuntime(3376): at kankan.wheel.demo.PasswActivity.onCreate(PasswActivity.java:72)
11-22 11:37:05.421: E/AndroidRuntime(3376): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
11-22 11:37:05.421: E/AndroidRuntime(3376): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2466)
11-22 11:37:05.421: E/AndroidRuntime(3376): ... 11 more
11-22 11:37:05.431: E/SemcCheckin(3376): Get crash dump level : java.io.FileNotFoundException: /data/semc-checkin/crashdump
11-22 11:37:05.441: I/dalvikvm(3376): threadid=7: reacting to signal 3
11-22 11:37:05.441: I/dalvikvm(3376): Wrote stack trace to '/data/anr/traces.txt'
11-22 11:37:07.311: D/dalvikvm(3383): GC freed 788 objects / 56384 bytes in 147ms
11-22 11:37:07.561: D/dalvikvm(3383): GC freed 240 objects / 10768 bytes in 54ms
11-22 11:37:26.111: D/dalvikvm(3436): GC freed 594 objects / 48896 bytes in 236ms
11-22 11:37:26.451: D/dalvikvm(3436): GC freed 205 objects / 9176 bytes in 55ms
11-22 11:37:34.391: D/dalvikvm(3436): GC freed 243 objects / 18336 bytes in 127ms
11-22 11:37:34.791: D/AndroidRuntime(3436): Shutting down VM
11-22 11:37:34.791: W/dalvikvm(3436): threadid=3: thread exiting with uncaught exception (group=0x40026160)
11-22 11:37:34.791: E/AndroidRuntime(3436): Uncaught handler: thread main exiting due to uncaught exception
11-22 11:37:34.791: E/AndroidRuntime(3436): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.insult.kp/kankan.wheel.demo.PasswActivity}: java.lang.ClassCastException: android.widget.ImageView
11-22 11:37:34.791: E/AndroidRuntime(3436): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2503)
11-22 11:37:34.791: E/AndroidRuntime(3436): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2519)
11-22 11:37:34.791: E/AndroidRuntime(3436): at android.app.ActivityThread.access$2200(ActivityThread.java:123)
11-22 11:37:34.791: E/AndroidRuntime(3436): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1870)
11-22 11:37:34.791: E/AndroidRuntime(3436): at android.os.Handler.dispatchMessage(Handler.java:99)
11-22 11:37:34.791: E/AndroidRuntime(3436): at android.os.Looper.loop(Looper.java:123)
11-22 11:37:34.791: E/AndroidRuntime(3436): at android.app.ActivityThread.main(ActivityThread.java:4370)
11-22 11:37:34.791: E/AndroidRuntime(3436): at java.lang.reflect.Method.invokeNative(Native Method)
11-22 11:37:34.791: E/AndroidRuntime(3436): at java.lang.reflect.Method.invoke(Method.java:521)
11-22 11:37:34.791: E/AndroidRuntime(3436): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
11-22 11:37:34.791: E/AndroidRuntime(3436): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
11-22 11:37:34.791: E/AndroidRuntime(3436): at dalvik.system.NativeStart.main(Native Method)
11-22 11:37:34.791: E/AndroidRuntime(3436): Caused by: java.lang.ClassCastException: android.widget.ImageView
11-22 11:37:34.791: E/AndroidRuntime(3436): at kankan.wheel.demo.PasswActivity.onCreate(PasswActivity.java:72)
11-22 11:37:34.791: E/AndroidRuntime(3436): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
11-22 11:37:34.791: E/AndroidRuntime(3436): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2466)
11-22 11:37:34.791: E/AndroidRuntime(3436): ... 11 more
11-22 11:37:34.801: E/SemcCheckin(3436): Get crash dump level : java.io.FileNotFoundException: /data/semc-checkin/crashdump
11-22 11:37:34.811: I/dalvikvm(3436): threadid=7: reacting to signal 3
11-22 11:37:34.831: I/dalvikvm(3436): Wrote stack trace to '/data/anr/traces.txt'
11-22 11:37:36.115: I/Process(3436): Sending signal. PID: 3436 SIG: 9
11-22 11:37:36.341: D/dalvikvm(3458): GC freed 601 objects / 49176 bytes in 89ms
11-22 11:37:36.601: D/dalvikvm(3458): GC freed 210 objects / 9400 bytes in 66ms
11-22 11:37:39.991: W/IInputConnectionWrapper(3458): showStatusIcon on inactive InputConnection
11-22 11:38:23.861: D/dalvikvm(3545): GC freed 774 objects / 55792 bytes in 515ms
11-22 11:38:24.071: D/dalvikvm(3545): GC freed 230 objects / 10368 bytes in 57ms
11-22 11:38:27.491: D/dalvikvm(3545): GC freed 243 objects / 18360 bytes in 60ms
11-22 11:38:27.731: D/AndroidRuntime(3545): Shutting down VM
11-22 11:38:27.731: W/dalvikvm(3545): threadid=3: thread exiting with uncaught exception (group=0x40026160)
11-22 11:38:27.731: E/AndroidRuntime(3545): Uncaught handler: thread main exiting due to uncaught exception
11-22 11:38:27.741: E/AndroidRuntime(3545): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.insult.kp/kankan.wheel.demo.PasswActivity}: java.lang.ClassCastException: android.widget.ImageView
11-22 11:38:27.741: E/AndroidRuntime(3545): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2503)
11-22 11:38:27.741: E/AndroidRuntime(3545): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2519)
11-22 11:38:27.741: E/AndroidRuntime(3545): at android.app.ActivityThread.access$2200(ActivityThread.java:123)
11-22 11:38:27.741: E/AndroidRuntime(3545): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1870)
11-22 11:38:27.741: E/AndroidRuntime(3545): at android.os.Handler.dispatchMessage(Handler.java:99)
11-22 11:38:27.741: E/AndroidRuntime(3545): at android.os.Looper.loop(Looper.java:123)
11-22 11:38:27.741: E/AndroidRuntime(3545): at android.app.ActivityThread.main(ActivityThread.java:4370)
11-22 11:38:27.741: E/AndroidRuntime(3545): at java.lang.reflect.Method.invokeNative(Native Method)
11-22 11:38:27.741: E/AndroidRuntime(3545): at java.lang.reflect.Method.invoke(Method.java:521)
11-22 11:38:27.741: E/AndroidRuntime(3545): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
11-22 11:38:27.741: E/AndroidRuntime(3545): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
11-22 11:38:27.741: E/AndroidRuntime(3545): at dalvik.system.NativeStart.main(Native Method)
11-22 11:38:27.741: E/AndroidRuntime(3545): Caused by: java.lang.ClassCastException: android.widget.ImageView
11-22 11:38:27.741: E/AndroidRuntime(3545): at kankan.wheel.demo.PasswActivity.onCreate(PasswActivity.java:72)
11-22 11:38:27.741: E/AndroidRuntime(3545): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
11-22 11:38:27.741: E/AndroidRuntime(3545): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2466)
11-22 11:38:27.741: E/AndroidRuntime(3545): ... 11 more
11-22 11:38:27.751: E/SemcCheckin(3545): Get crash dump level : java.io.FileNotFoundException: /data/semc-checkin/crashdump
11-22 11:38:27.761: I/dalvikvm(3545): threadid=7: reacting to signal 3
11-22 11:38:27.761: I/dalvikvm(3545): Wrote stack trace to '/data/anr/traces.txt'
11-22 11:38:32.201: D/dalvikvm(3552): GC freed 779 objects / 56024 bytes in 142ms
11-22 11:38:32.441: D/dalvikvm(3552): GC freed 230 objects / 10368 bytes in 55ms
11-22 11:41:22.251: D/dalvikvm(3552): GC freed 341 objects / 24264 bytes in 60ms
11-22 11:41:22.541: D/AndroidRuntime(3552): Shutting down VM
11-22 11:41:22.541: W/dalvikvm(3552): threadid=3: thread exiting with uncaught exception (group=0x40026160)
11-22 11:41:22.541: E/AndroidRuntime(3552): Uncaught handler: thread main exiting due to uncaught exception
11-22 11:41:22.541: E/AndroidRuntime(3552): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.insult.kp/kankan.wheel.demo.PasswActivity}: java.lang.ClassCastException: android.widget.ImageView
11-22 11:41:22.541: E/AndroidRuntime(3552): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2503)
11-22 11:41:22.541: E/AndroidRuntime(3552): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2519)
11-22 11:41:22.541: E/AndroidRuntime(3552): at android.app.ActivityThread.access$2200(ActivityThread.java:123)
11-22 11:41:22.541: E/AndroidRuntime(3552): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1870)
11-22 11:41:22.541: E/AndroidRuntime(3552): at android.os.Handler.dispatchMessage(Handler.java:99)
11-22 11:41:22.541: E/AndroidRuntime(3552): at android.os.Looper.loop(Looper.java:123)
11-22 11:41:22.541: E/AndroidRuntime(3552): at android.app.ActivityThread.main(ActivityThread.java:4370)
11-22 11:41:22.541: E/AndroidRuntime(3552): at java.lang.reflect.Method.invokeNative(Native Method)
11-22 11:41:22.541: E/AndroidRuntime(3552): at java.lang.reflect.Method.invoke(Method.java:521)
11-22 11:41:22.541: E/AndroidRuntime(3552): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
11-22 11:41:22.541: E/AndroidRuntime(3552): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
11-22 11:41:22.541: E/AndroidRuntime(3552): at dalvik.system.NativeStart.main(Native Method)
11-22 11:41:22.541: E/AndroidRuntime(3552): Caused by: java.lang.ClassCastException: android.widget.ImageView
11-22 11:41:22.541: E/AndroidRuntime(3552): at kankan.wheel.demo.PasswActivity.onCreate(PasswActivity.java:72)
11-22 11:41:22.541: E/AndroidRuntime(3552): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
11-22 11:41:22.541: E/AndroidRuntime(3552): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2466)
11-22 11:41:22.541: E/AndroidRuntime(3552): ... 11 more
11-22 11:41:22.551: E/SemcCheckin(3552): Get crash dump level : java.io.FileNotFoundException: /data/semc-checkin/crashdump
11-22 11:41:22.561: I/dalvikvm(3552): threadid=7: reacting to signal 3
11-22 11:41:22.571: I/dalvikvm(3552): Wrote stack trace to '/data/anr/traces.txt'
11-22 11:41:24.612: I/Process(3552): Sending signal. PID: 3552 SIG: 9
11-22 11:41:24.831: D/dalvikvm(3626): GC freed 579 objects / 48312 bytes in 79ms
11-22 11:41:25.031: D/dalvikvm(3626): GC freed 205 objects / 9248 bytes in 55ms
11-22 11:41:34.621: D/dalvikvm(3626): GC freed 313 objects / 22008 bytes in 55ms
11-22 11:41:35.651: D/dalvikvm(3626): GC freed 119 objects / 7392 bytes in 56ms
11-22 11:41:36.231: D/dalvikvm(3626): GC freed 86 objects / 6432 bytes in 63ms
11-22 11:41:36.641: D/dalvikvm(3626): GC freed 77 objects / 6024 bytes in 56ms
11-22 11:41:37.041: D/dalvikvm(3626): GC freed 77 objects / 6016 bytes in 56ms
11-22 11:41:38.661: D/dalvikvm(3626): GC freed 182 objects / 17224 bytes in 57ms
11-22 11:41:38.741: D/AndroidRuntime(3626): Shutting down VM
11-22 11:41:38.741: W/dalvikvm(3626): threadid=3: thread exiting with uncaught exception (group=0x40026160)
11-22 11:41:38.741: E/AndroidRuntime(3626): Uncaught handler: thread main exiting due to uncaught exception
11-22 11:41:38.751: E/AndroidRuntime(3626): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.insult.kp/kankan.wheel.demo.PasswActivity}: java.lang.ClassCastException: android.widget.ImageView
11-22 11:41:38.751: E/AndroidRuntime(3626): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2503)
11-22 11:41:38.751: E/AndroidRuntime(3626): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2519)
11-22 11:41:38.751: E/AndroidRuntime(3626): at android.app.ActivityThread.access$2200(ActivityThread.java:123)
11-22 11:41:38.751: E/AndroidRuntime(3626): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1870)
11-22 11:41:38.751: E/AndroidRuntime(3626): at android.os.Handler.dispatchMessage(Handler.java:99)
11-22 11:41:38.751: E/AndroidRuntime(3626): at android.os.Looper.loop(Looper.java:123)
11-22 11:41:38.751: E/AndroidRuntime(3626): at android.app.ActivityThread.main(ActivityThread.java:4370)
11-22 11:41:38.751: E/AndroidRuntime(3626): at java.lang.reflect.Method.invokeNative(Native Method)
11-22 11:41:38.751: E/AndroidRuntime(3626): at java.lang.reflect.Method.invoke(Method.java:521)
11-22 11:41:38.751: E/AndroidRuntime(3626): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
11-22 11:41:38.751: E/AndroidRuntime(3626): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
11-22 11:41:38.751: E/AndroidRuntime(3626): at dalvik.system.NativeStart.main(Native Method)
11-22 11:41:38.751: E/AndroidRuntime(3626): Caused by: java.lang.ClassCastException: android.widget.ImageView
11-22 11:41:38.751: E/AndroidRuntime(3626): at kankan.wheel.demo.PasswActivity.onCreate(PasswActivity.java:72)
11-22 11:41:38.751: E/AndroidRuntime(3626): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
11-22 11:41:38.751: E/AndroidRuntime(3626): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2466)
11-22 11:41:38.751: E/AndroidRuntime(3626): ... 11 more
11-22 11:41:38.751: E/SemcCheckin(3626): Get crash dump level : java.io.FileNotFoundException: /data/semc-checkin/crashdump
11-22 11:41:38.761: I/dalvikvm(3626): threadid=7: reacting to signal 3
11-22 11:41:38.771: I/dalvikvm(3626): Wrote stack trace to '/data/anr/traces.txt'
11-22 11:41:41.161: D/dalvikvm(3636): GC freed 601 objects / 49168 bytes in 71ms
11-22 11:41:41.371: D/dalvikvm(3636): GC freed 205 objects / 9248 bytes in 54ms
11-22 11:42:06.711: W/IInputConnectionWrapper(3636): showStatusIcon on inactive InputConnection
11-22 11:42:14.291: D/dalvikvm(3695): GC freed 748 objects / 54816 bytes in 203ms
11-22 11:42:14.691: D/dalvikvm(3695): GC freed 220 objects / 9968 bytes in 59ms
11-22 11:42:16.721: D/dalvikvm(3695): GC freed 243 objects / 18368 bytes in 59ms
11-22 11:42:17.161: D/AndroidRuntime(3695): Shutting down VM
11-22 11:42:17.161: W/dalvikvm(3695): threadid=3: thread exiting with uncaught exception (group=0x40026160)
11-22 11:42:17.161: E/AndroidRuntime(3695): Uncaught handler: thread main exiting due to uncaught exception
11-22 11:42:17.171: E/AndroidRuntime(3695): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.insult.kp/kankan.wheel.demo.PasswActivity}: java.lang.ClassCastException: android.widget.ImageView
11-22 11:42:17.171: E/AndroidRuntime(3695): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2503)
11-22 11:42:17.171: E/AndroidRuntime(3695): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2519)
11-22 11:42:17.171: E/AndroidRuntime(3695): at android.app.ActivityThread.access$2200(ActivityThread.java:123)
11-22 11:42:17.171: E/AndroidRuntime(3695): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1870)
11-22 11:42:17.171: E/AndroidRuntime(3695): at android.os.Handler.dispatchMessage(Handler.java:99)
11-22 11:42:17.171: E/AndroidRuntime(3695): at android.os.Looper.loop(Looper.java:123)
11-22 11:42:17.171: E/AndroidRuntime(3695): at android.app.ActivityThread.main(ActivityThread.java:4370)
11-22 11:42:17.171: E/AndroidRuntime(3695): at java.lang.reflect.Method.invokeNative(Native Method)
11-22 11:42:17.171: E/AndroidRuntime(3695): at java.lang.reflect.Method.invoke(Method.java:521)
11-22 11:42:17.171: E/AndroidRuntime(3695): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
11-22 11:42:17.171: E/AndroidRuntime(3695): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
11-22 11:42:17.171: E/AndroidRuntime(3695): at dalvik.system.NativeStart.main(Native Method)
11-22 11:42:17.171: E/AndroidRuntime(3695): Caused by: java.lang.ClassCastException: android.widget.ImageView
11-22 11:42:17.171: E/AndroidRuntime(3695): at kankan.wheel.demo.PasswActivity.onCreate(PasswActivity.java:72)
11-22 11:42:17.171: E/AndroidRuntime(3695): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
11-22 11:42:17.171: E/AndroidRuntime(3695): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2466)
11-22 11:42:17.171: E/AndroidRuntime(3695): ... 11 more
11-22 11:42:17.181: E/SemcCheckin(3695): Get crash dump level : java.io.FileNotFoundException: /data/semc-checkin/crashdump
11-22 11:42:17.181: I/dalvikvm(3695): threadid=7: reacting to signal 3
11-22 11:42:17.191: I/dalvikvm(3695): Wrote stack trace to '/data/anr/traces.txt'
11-22 11:42:21.771: D/dalvikvm(3711): GC freed 750 objects / 54904 bytes in 69ms
11-22 11:42:21.981: D/dalvikvm(3711): GC freed 220 objects / 9960 bytes in 54ms
11-22 11:42:43.901: D/dalvikvm(3711): GC freed 341 objects / 24248 bytes in 57ms
11-22 11:42:44.131: D/AndroidRuntime(3711): Shutting down VM
11-22 11:42:44.131: W/dalvikvm(3711): threadid=3: thread exiting with uncaught exception (group=0x40026160)
11-22 11:42:44.131: E/AndroidRuntime(3711): Uncaught handler: thread main exiting due to uncaught exception
11-22 11:42:44.141: E/AndroidRuntime(3711): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.insult.kp/kankan.wheel.demo.PasswActivity}: java.lang.ClassCastException: android.widget.ImageView
11-22 11:42:44.141: E/AndroidRuntime(3711): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2503)
11-22 11:42:44.141: E/AndroidRuntime(3711): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2519)
11-22 11:42:44.141: E/AndroidRuntime(3711): at android.app.ActivityThread.access$2200(ActivityThread.java:123)
11-22 11:42:44.141: E/AndroidRuntime(3711): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1870)
11-22 11:42:44.141: E/AndroidRuntime(3711): at android.os.Handler.dispatchMessage(Handler.java:99)
11-22 11:42:44.141: E/AndroidRuntime(3711): at android.os.Looper.loop(Looper.java:123)
11-22 11:42:44.141: E/AndroidRuntime(3711): at android.app.ActivityThread.main(ActivityThread.java:4370)
11-22 11:42:44.141: E/AndroidRuntime(3711): at java.lang.reflect.Method.invokeNative(Native Method)
11-22 11:42:44.141: E/AndroidRuntime(3711): at java.lang.reflect.Method.invoke(Method.java:521)
11-22 11:42:44.141: E/AndroidRuntime(3711): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
11-22 11:42:44.141: E/AndroidRuntime(3711): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
11-22 11:42:44.141: E/AndroidRuntime(3711): at dalvik.system.NativeStart.main(Native Method)
11-22 11:42:44.141: E/AndroidRuntime(3711): Caused by: java.lang.ClassCastException: android.widget.ImageView
11-22 11:42:44.141: E/AndroidRuntime(3711): at kankan.wheel.demo.PasswActivity.onCreate(PasswActivity.java:72)
11-22 11:42:44.141: E/AndroidRuntime(3711): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
11-22 11:42:44.141: E/AndroidRuntime(3711): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2466)
11-22 11:42:44.141: E/AndroidRuntime(3711): ... 11 more
11-22 11:42:44.151: E/SemcCheckin(3711): Get crash dump level : java.io.FileNotFoundException: /data/semc-checkin/crashdump
11-22 11:42:44.161: I/dalvikvm(3711): threadid=7: reacting to signal 3
11-22 11:42:44.191: I/dalvikvm(3711): Wrote stack trace to '/data/anr/traces.txt'
Either:
you are calling findViewById() on the wrong thing, and therefore are getting an ImageView when you are expecting something else
your R class is out of sync with the rest of your code, which can be fixed by cleaning your project (Project > Clean from the Eclipse main menu, or ant clean from the command line)
Hey all, I received a termination on my app and this error in the logcat:
11-22 22:41:25.193: ERROR/AndroidRuntime(30974): FATAL EXCEPTION: main
11-22 22:41:25.193: ERROR/AndroidRuntime(30974): java.lang.ArrayIndexOutOfBoundsException
11-22 22:41:25.193: ERROR/AndroidRuntime(30974): at com.project.main.main.analyzeFace(main.java:316)
11-22 22:41:25.193: ERROR/AndroidRuntime(30974): at com.project.main.main.access$1(main.java:209)
11-22 22:41:25.193: ERROR/AndroidRuntime(30974): at com.project.main.main$1$1.run(main.java:381)
11-22 22:41:25.193: ERROR/AndroidRuntime(30974): at android.os.Handler.handleCallback(Handler.java:587)
11-22 22:41:25.193: ERROR/AndroidRuntime(30974): at android.os.Handler.dispatchMessage(Handler.java:92)
11-22 22:41:25.193: ERROR/AndroidRuntime(30974): at android.os.Looper.loop(Looper.java:143)
11-22 22:41:25.193: ERROR/AndroidRuntime(30974): at android.app.ActivityThread.main(ActivityThread.java:4701)
11-22 22:41:25.193: ERROR/AndroidRuntime(30974): at java.lang.reflect.Method.invokeNative(Native Method)
11-22 22:41:25.193: ERROR/AndroidRuntime(30974): at java.lang.reflect.Method.invoke(Method.java:521)
11-22 22:41:25.193: ERROR/AndroidRuntime(30974): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
11-22 22:41:25.193: ERROR/AndroidRuntime(30974): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
11-22 22:41:25.193: ERROR/AndroidRuntime(30974): at dalvik.system.NativeStart.main(Native Method)
When I tried snapping a photo in my app. Any idea what this could be?
You are pointing to an offset of an array which is bigger than the number of array's elements (non-initialized index).
Most likely you're iterating over an array with a helper variable, and incrementing it in each iteration, but at some point, that variable gets over the number of elements in the array.
The index you tried to access may be over its total count. Make sure the index number is in range of array you are using. it's hard to answer without source code.