Note that there are some explanatory texts on larger screens.

plurals
  1. POI want to print an integer to the screen, add one to it and then print the answer to this for a given loop (say up until 10)
    primarykey
    data
    text
    <p>Rather than do this by just creating a lot of strings (which I've already managed), I want to add an integer and then print those list to the screen. At the moment, I'm just trying to get one integer on the screen without even adding it, but the app is "force closed" in the emulator. Why doesn't this work? </p> <p>Code:</p> <pre><code>package com.monkeez.count; import android.app.Activity; import android.os.Bundle; import android.app.Activity; import android.view.View; import android.widget.TextView; public class Count extends Activity { /** Called when the activity is first created. */ TextView countDisplay; @Override public void onCreate (Bundle savedInstanceState) { int counter = 1; countDisplay = new TextView(this); this.setContentView(countDisplay); countDisplay.setText("counter here"); } } </code></pre> <p>The log cat is thus: </p> <pre><code>09-01 09:54:07.051: DEBUG/AndroidRuntime(279): &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; AndroidRuntime START &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt; 09-01 09:54:07.051: DEBUG/AndroidRuntime(279): CheckJNI is ON 09-01 09:54:07.401: DEBUG/AndroidRuntime(279): --- registering native functions --- 09-01 09:54:08.891: DEBUG/dalvikvm(193): GC_EXPLICIT freed 320 objects / 19376 bytes in 109ms 09-01 09:54:09.041: DEBUG/PackageParser(65): Scanning package: /data/app/vmdl48927.tmp 09-01 09:54:09.251: INFO/PackageManager(65): Removing non-system package:com.monkeez.count 09-01 09:54:09.251: INFO/ActivityManager(65): Force stopping package com.monkeez.count uid=10037 09-01 09:54:09.991: DEBUG/PackageManager(65): Scanning package com.monkeez.count 09-01 09:54:09.991: INFO/PackageManager(65): Package com.monkeez.count codePath changed from /data/app/com.monkeez.count-2.apk to /data/app/com.monkeez.count-1.apk; Retaining data and using new 09-01 09:54:10.011: INFO/PackageManager(65): /data/app/com.monkeez.count-1.apk changed; unpacking 09-01 09:54:10.054: DEBUG/installd(34): DexInv: --- BEGIN '/data/app/com.monkeez.count-1.apk' --- 09-01 09:54:10.511: DEBUG/dalvikvm(286): DexOpt: load 169ms, verify 64ms, opt 4ms 09-01 09:54:10.591: DEBUG/installd(34): DexInv: --- END '/data/app/com.monkeez.count-1.apk' (success) --- 09-01 09:54:10.602: WARN/PackageManager(65): Code path for pkg : com.monkeez.count changing from /data/app/com.monkeez.count-2.apk to /data/app/com.monkeez.count-1.apk 09-01 09:54:10.602: WARN/PackageManager(65): Resource path for pkg : com.monkeez.count changing from /data/app/com.monkeez.count-2.apk to /data/app/com.monkeez.count-1.apk 09-01 09:54:10.611: DEBUG/PackageManager(65): Activities: com.monkeez.count.Count 09-01 09:54:10.650: INFO/ActivityManager(65): Force stopping package com.monkeez.count uid=10037 09-01 09:54:11.631: INFO/installd(34): move /data/dalvik-cache/data@app@com.monkeez.count-1.apk@classes.dex -&gt; /data/dalvik-cache/data@app@com.monkeez.count-1.apk@classes.dex 09-01 09:54:11.641: DEBUG/PackageManager(65): New package installed in /data/app/com.monkeez.count-1.apk 09-01 09:54:11.821: DEBUG/dalvikvm(65): GC_FOR_MALLOC freed 6733 objects / 446400 bytes in 140ms 09-01 09:54:12.561: INFO/ActivityManager(65): Force stopping package com.monkeez.count uid=10037 09-01 09:54:12.711: DEBUG/dalvikvm(126): GC_EXPLICIT freed 1940 objects / 106408 bytes in 121ms 09-01 09:54:13.351: WARN/RecognitionManagerService(65): no available voice recognition services found 09-01 09:54:13.831: DEBUG/dalvikvm(65): GC_EXPLICIT freed 4667 objects / 280056 bytes in 173ms 09-01 09:54:13.901: DEBUG/dalvikvm(165): GC_EXPLICIT freed 2326 objects / 125088 bytes in 1059ms 09-01 09:54:14.180: INFO/installd(34): unlink /data/dalvik-cache/data@app@com.monkeez.count-2.apk@classes.dex 09-01 09:54:14.271: DEBUG/AndroidRuntime(279): Shutting down VM 09-01 09:54:14.290: DEBUG/dalvikvm(279): Debugger has detached; object registry had 1 entries 09-01 09:54:14.340: INFO/AndroidRuntime(279): NOTE: attach of thread 'Binder Thread #3' failed 09-01 09:54:15.350: DEBUG/AndroidRuntime(291): &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; AndroidRuntime START &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt; 09-01 09:54:15.350: DEBUG/AndroidRuntime(291): CheckJNI is ON 09-01 09:54:15.740: DEBUG/AndroidRuntime(291): --- registering native functions --- 09-01 09:54:16.960: INFO/ActivityManager(65): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.monkeez.count/.Count } 09-01 09:54:17.120: DEBUG/AndroidRuntime(291): Shutting down VM 09-01 09:54:17.170: DEBUG/dalvikvm(291): Debugger has detached; object registry had 1 entries 09-01 09:54:17.250: INFO/AndroidRuntime(291): NOTE: attach of thread 'Binder Thread #3' failed 09-01 09:54:17.301: INFO/ActivityManager(65): Start proc com.monkeez.count for activity com.monkeez.count/.Count: pid=298 uid=10037 gids={} 09-01 09:54:18.611: WARN/ResourceType(298): No package identifier when getting value for resource number 0x00000001 09-01 09:54:18.620: DEBUG/AndroidRuntime(298): Shutting down VM 09-01 09:54:18.620: WARN/dalvikvm(298): threadid=1: thread exiting with uncaught exception (group=0x4001d800) 09-01 09:54:18.680: ERROR/AndroidRuntime(298): FATAL EXCEPTION: main 09-01 09:54:18.680: ERROR/AndroidRuntime(298): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.monkeez.count/com.monkeez.count.Count}: android.content.res.Resources$NotFoundException: String resource ID #0x1 09-01 09:54:18.680: ERROR/AndroidRuntime(298): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663) 09-01 09:54:18.680: ERROR/AndroidRuntime(298): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679) 09-01 09:54:18.680: ERROR/AndroidRuntime(298): at android.app.ActivityThread.access$2300(ActivityThread.java:125) 09-01 09:54:18.680: ERROR/AndroidRuntime(298): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033) 09-01 09:54:18.680: ERROR/AndroidRuntime(298): at android.os.Handler.dispatchMessage(Handler.java:99) 09-01 09:54:18.680: ERROR/AndroidRuntime(298): at android.os.Looper.loop(Looper.java:123) 09-01 09:54:18.680: ERROR/AndroidRuntime(298): at android.app.ActivityThread.main(ActivityThread.java:4627) 09-01 09:54:18.680: ERROR/AndroidRuntime(298): at java.lang.reflect.Method.invokeNative(Native Method) 09-01 09:54:18.680: ERROR/AndroidRuntime(298): at java.lang.reflect.Method.invoke(Method.java:521) 09-01 09:54:18.680: ERROR/AndroidRuntime(298): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 09-01 09:54:18.680: ERROR/AndroidRuntime(298): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 09-01 09:54:18.680: ERROR/AndroidRuntime(298): at dalvik.system.NativeStart.main(Native Method) 09-01 09:54:18.680: ERROR/AndroidRuntime(298): Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x1 09-01 09:54:18.680: ERROR/AndroidRuntime(298): at android.content.res.Resources.getText(Resources.java:201) 09-01 09:54:18.680: ERROR/AndroidRuntime(298): at android.widget.TextView.setText(TextView.java:2817) 09-01 09:54:18.680: ERROR/AndroidRuntime(298): at com.monkeez.count.Count.onCreate(Count.java:19) 09-01 09:54:18.680: ERROR/AndroidRuntime(298): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 09-01 09:54:18.680: ERROR/AndroidRuntime(298): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627) 09-01 09:54:18.680: ERROR/AndroidRuntime(298): ... 11 more 09-01 09:54:18.940: WARN/ActivityManager(65): Force finishing activity com.monkeez.count/.Count 09-01 09:54:19.470: WARN/ActivityManager(65): Activity pause timeout for HistoryRecord{43fb6718 com.monkeez.count/.Count} 09-01 09:54:19.550: INFO/ARMAssembler(65): generated scanline__00000077:03515104_00000000_00000000 [ 33 ipp] (47 ins) at [0x2de138:0x2de1f4] in 602730 ns 09-01 09:54:22.523: WARN/InputManagerService(65): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@43f92978 09-01 09:54:22.681: INFO/Process(298): Sending signal. PID: 298 SIG: 9 09-01 09:54:22.826: INFO/ActivityManager(65): Process com.monkeez.count (pid 298) has died. </code></pre> <p>And the Count Manifest.xml is thus: </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.monkeez.count" android:versionCode="1" android:versionName="1.0"&gt; &lt;application android:icon="@drawable/icon" android:label="@string/app_name"&gt; &lt;activity android:name=".Count" 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;/application&gt; &lt;uses-sdk android:minSdkVersion="8" /&gt; &lt;/manifest&gt; </code></pre> <p>Thanks </p> <p>ps. it seems that the parser on this site doesn't like to render my xml file - you can see it at <a href="http://pastebin.com/raw.php?i=W75ak3E9" rel="nofollow noreferrer">http://pastebin.com/raw.php?i=W75ak3E9</a></p>
    singulars
    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.
 

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