Note that there are some explanatory texts on larger screens.

plurals
  1. POStartActivity crashes in ListView.setOnItemClickListener
    text
    copied!<p>I have an odd issue with starting an activity. I am able to start it from a menu using</p> <pre><code>Intent intent = new Intent(this,SplashScreen.class); this.startActivity(intent); </code></pre> <p>but if i try starting it from ListView.setOnItemClickListener, it crashes. However i tried all kind of methods, the result is the same (the activity i wanna start is a blank screen, so nothing suspicious about it). Here is the current code...</p> <pre><code> list.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { startActivity(new Intent(getBaseContext(), SplashScreen.class)); }}); </code></pre> <p>The activity is added to the manifest... And the main class extends activity.</p> <p>The LogCat</p> <pre><code>02-23 17:17:11.070: W/dalvikvm(3200): threadid=1: thread exiting with uncaught exception (group=0x40a13300) 02-23 17:17:11.248: E/AndroidRuntime(3200): FATAL EXCEPTION: main 02-23 17:17:11.248: E/AndroidRuntime(3200): java.lang.RuntimeException: Unable to start activity ComponentInfo{ro.pca.rentme/ro.pca.rentme.SplashScreen}: java.lang.NullPointerException 02-23 17:17:11.248: E/AndroidRuntime(3200): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059) 02-23 17:17:11.248: E/AndroidRuntime(3200): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) 02-23 17:17:11.248: E/AndroidRuntime(3200): at android.app.ActivityThread.access$600(ActivityThread.java:130) 02-23 17:17:11.248: E/AndroidRuntime(3200): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) 02-23 17:17:11.248: E/AndroidRuntime(3200): at android.os.Handler.dispatchMessage(Handler.java:99) 02-23 17:17:11.248: E/AndroidRuntime(3200): at android.os.Looper.loop(Looper.java:137) 02-23 17:17:11.248: E/AndroidRuntime(3200): at android.app.ActivityThread.main(ActivityThread.java:4745) 02-23 17:17:11.248: E/AndroidRuntime(3200): at java.lang.reflect.Method.invokeNative(Native Method) 02-23 17:17:11.248: E/AndroidRuntime(3200): at java.lang.reflect.Method.invoke(Method.java:511) 02-23 17:17:11.248: E/AndroidRuntime(3200): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 02-23 17:17:11.248: E/AndroidRuntime(3200): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 02-23 17:17:11.248: E/AndroidRuntime(3200): at dalvik.system.NativeStart.main(Native Method) 02-23 17:17:11.248: E/AndroidRuntime(3200): Caused by: java.lang.NullPointerException 02-23 17:17:11.248: E/AndroidRuntime(3200): at ro.pca.rentme.SplashScreen.onCreate(SplashScreen.java:46) 02-23 17:17:11.248: E/AndroidRuntime(3200): at android.app.Activity.performCreate(Activity.java:5008) 02-23 17:17:11.248: E/AndroidRuntime(3200): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079) 02-23 17:17:11.248: E/AndroidRuntime(3200): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023) 02-23 17:17:11.248: E/AndroidRuntime(3200): ... 11 more </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload