Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid Application crashing before running. Intent Problem or else?
    primarykey
    data
    text
    <p>Problem is simple. Two Activities. One throwing intent at other. Project have name : "Stupidroid" package : "com.examples.stupidroid" activity : "stupidOnSteroids"</p> <p>below is <strong>stupidOnSteroids .java</strong></p> <pre><code>package com.examples.stupidroid; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; public class stupidOnSteroids extends Activity { private Button buttonThatWillTakeYouPlacesButton; private Intent intentThatwillTakeYouPlacesIntent; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); InitLayouts(); InitSetOnClickListeners(); } private void InitSetOnClickListeners() { buttonThatWillTakeYouPlacesButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { intentThatwillTakeYouPlacesIntent.setAction(""); } }); } private void InitLayouts() { buttonThatWillTakeYouPlacesButton = (Button)findViewById(R.id.buttonThatWillGiveThyPowerButton); intentThatwillTakeYouPlacesIntent = new Intent(stupidOnSteroids.this, Calc_print_codefile.class); } } </code></pre> <p>now is <strong>main.xml</strong></p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="right" &gt; &lt;Button android:id="@+id/goToOtherMoronButton" android:text="Next Activity" android:layout_width="wrap_content" android:layout_height="wrap_content" &gt;&lt;/Button&gt; &lt;/LinearLayout&gt; </code></pre> <p>now is another java file : <strong>Calc_print_codefile.java</strong></p> <pre><code>package com.examples.stupidroid; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.TextView; public class Calc_print_codefile extends Activity{ Button buttonThatWillHelpYouCalculateButton; TextView textThatWillTakeTheHitText; Button buttonThatWillTakeYouHomeButton; Intent intentThatWillTakeYouHomeIntent; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.calc_prin_layout); InitLayouts(); InitSetOnClickListener(); } private void InitSetOnClickListener() { buttonThatWillHelpYouCalculateButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { for(int i=0; i&lt;32000; i++){ textThatWillTakeTheHitText.setText(i); } } }); } private void InitLayouts() { buttonThatWillHelpYouCalculateButton = (Button)findViewById(R.id.buttonThatWillGiveThyPowerButton); textThatWillTakeTheHitText = (TextView)findViewById(R.id.textThatWillAbsolveThyText); intentThatWillTakeYouHomeIntent = new Intent(Calc_print_codefile.this, stupidOnSteroids.class); } } </code></pre> <p>corresponding xml : calc_prin_layout.xml</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;TextView android:id="@+id/textThatWillAbsolveThyText" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text=" " /&gt; &lt;Button android:id="@+id/buttonThatWillGiveThyPowerButton" android:text="Press ME, hard!" android:layout_width="fill_parent" android:layout_height="wrap_content"&gt;&lt;/Button&gt; &lt;/LinearLayout&gt; </code></pre> <p>below is <strong>AndroidManifest.xml</strong></p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.examples.stupidroid" android:versionCode="1" android:versionName="1.0"&gt; &lt;application android:icon="@drawable/icon" android:label="@string/app_name"&gt; &lt;activity android:name=".stupidOnSteroids" android:label="@string/app_name"&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;activity android:name="Calc_print_codefile"&gt;&lt;/activity&gt; &lt;/application&gt; &lt;uses-sdk android:minSdkVersion="8" /&gt; &lt;/manifest&gt; </code></pre> <p>Here are images (actually one only):</p> <p><img src="https://i.stack.imgur.com/NwCrG.png" alt="Crashing even before running"></p> <p>now is information from DDMS</p> <pre><code>07-29 14:13:31.344: WARN/ActivityThread(379): Application com.examples.stupidroid is waiting for the debugger on port 8100... 07-29 14:13:31.374: INFO/System.out(379): Sending WAIT chunk 07-29 14:13:31.434: INFO/dalvikvm(379): Debugger is active 07-29 14:13:31.594: INFO/System.out(379): Debugger has connected 07-29 14:13:31.604: INFO/System.out(379): waiting for debugger to settle... 07-29 14:13:31.804: INFO/System.out(379): waiting for debugger to settle... 07-29 14:13:31.824: DEBUG/dalvikvm(33): GC_EXPLICIT freed 2 objects / 64 bytes in 556ms 07-29 14:13:32.038: INFO/System.out(379): waiting for debugger to settle... 07-29 14:13:32.296: INFO/System.out(379): waiting for debugger to settle... 07-29 14:13:32.444: WARN/ActivityManager(60): Activity destroy timeout for HistoryRecord{440534a8 com.examples.stupidroid/.stupidOnSteroids} 07-29 14:13:32.494: INFO/System.out(379): waiting for debugger to settle... 07-29 14:13:32.694: INFO/System.out(379): waiting for debugger to settle... 07-29 14:13:32.894: INFO/System.out(379): waiting for debugger to settle... 07-29 14:13:33.113: INFO/System.out(379): waiting for debugger to settle... 07-29 14:13:33.356: INFO/System.out(379): waiting for debugger to settle... 07-29 14:13:33.574: INFO/System.out(379): waiting for debugger to settle... 07-29 14:13:33.795: INFO/System.out(379): waiting for debugger to settle... 07-29 14:13:34.008: INFO/System.out(379): waiting for debugger to settle... 07-29 14:13:34.215: INFO/System.out(379): waiting for debugger to settle... 07-29 14:13:34.423: INFO/System.out(379): waiting for debugger to settle... 07-29 14:13:34.634: INFO/System.out(379): waiting for debugger to settle... 07-29 14:13:34.868: INFO/System.out(379): debugger has settled (1504) 07-29 14:13:40.587: WARN/ActivityManager(60): Launch timeout has expired, giving up wake lock! 07-29 14:13:41.254: WARN/ActivityManager(60): Activity idle timeout for HistoryRecord{44078b28 com.examples.stupidroid/.stupidOnSteroids} 07-29 14:13:46.454: DEBUG/dalvikvm(135): GC_EXPLICIT freed 1190 objects / 62584 bytes in 179ms 07-29 14:13:57.363: DEBUG/dalvikvm(60): GC_FOR_MALLOC freed 12320 objects / 698248 bytes in 153ms 07-29 14:13:58.423: DEBUG/AndroidRuntime(379): Shutting down VM 07-29 14:13:58.423: WARN/dalvikvm(379): threadid=1: thread exiting with uncaught exception (group=0x4001d800) **07-29 14:13:58.543: ERROR/AndroidRuntime(379): FATAL EXCEPTION: main 07-29 14:13:58.543: ERROR/AndroidRuntime(379): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.examples.stupidroid/com.examples.stupidroid.stupidOnSteroids}: java.lang.NullPointerException** 07-29 14:13:58.543: ERROR/AndroidRuntime(379): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663) 07-29 14:13:58.543: ERROR/AndroidRuntime(379): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679) 07-29 14:13:58.543: ERROR/AndroidRuntime(379): at android.app.ActivityThread.access$2300(ActivityThread.java:125) 07-29 14:13:58.543: ERROR/AndroidRuntime(379): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033) 07-29 14:13:58.543: ERROR/AndroidRuntime(379): at android.os.Handler.dispatchMessage(Handler.java:99) 07-29 14:13:58.543: ERROR/AndroidRuntime(379): at android.os.Looper.loop(Looper.java:123) 07-29 14:13:58.543: ERROR/AndroidRuntime(379): at android.app.ActivityThread.main(ActivityThread.java:4627) 07-29 14:13:58.543: ERROR/AndroidRuntime(379): at java.lang.reflect.Method.invokeNative(Native Method) 07-29 14:13:58.543: ERROR/AndroidRuntime(379): at java.lang.reflect.Method.invoke(Method.java:521) 07-29 14:13:58.543: ERROR/AndroidRuntime(379): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 07-29 14:13:58.543: ERROR/AndroidRuntime(379): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 07-29 14:13:58.543: ERROR/AndroidRuntime(379): at dalvik.system.NativeStart.main(Native Method) 07-29 14:13:58.543: ERROR/AndroidRuntime(379): Caused by: java.lang.NullPointerException 07-29 14:13:58.543: ERROR/AndroidRuntime(379): at com.examples.stupidroid.stupidOnSteroids.InitSetOnClickListeners(stupidOnSteroids.java:20) 07-29 14:13:58.543: ERROR/AndroidRuntime(379): at com.examples.stupidroid.stupidOnSteroids.onCreate(stupidOnSteroids.java:17) 07-29 14:13:58.543: ERROR/AndroidRuntime(379): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 07-29 14:13:58.543: ERROR/AndroidRuntime(379): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627) 07-29 14:13:58.543: ERROR/AndroidRuntime(379): ... 11 more 07-29 14:13:58.613: WARN/ActivityManager(60): Force finishing activity com.examples.stupidroid/.stupidOnSteroids 07-29 14:13:59.128: WARN/ActivityManager(60): Activity pause timeout for HistoryRecord{44078b28 com.examples.stupidroid/.stupidOnSteroids} 07-29 14:14:09.273: WARN/ActivityManager(60): Activity destroy timeout for HistoryRecord{44078b28 com.examples.stupidroid/.stupidOnSteroids} 07-29 14:14:13.443: INFO/Process(379): Sending signal. PID: 379 SIG: 9 07-29 14:14:13.465: INFO/ActivityManager(60): Process com.examples.stupidroid (pid 379) has died. 07-29 14:14:13.483: WARN/InputManagerService(60): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@43ef9a68 </code></pre> <p>Please tell me what can I do? I have followed same approach the other guy followed. My other project is working. what can it be? is it wrong nomenclature or what? From my past experiences, it looks like very small very narrow mistake , might be silly, still can't put my finger at it. Thanks for spending time reading this.</p> <p>And oh, if I remove InitSetOnClickListeners(); from stupidOnSteroids.java file, I can at least see a button. So, there might be error.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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