Are there any examples of adding textviews and radio button through
code?
On Mar 5, 7:54 pm, automerc <[email protected]> wrote:
> I think this is what caused the error
>
> 03-05 19:50:55.975: DEBUG/dalvikvm(224): VM cleaning up
> 03-05 19:50:55.975: DEBUG/dalvikvm(224): LinearAlloc 0x0 used 541260
> of 4194304 (12%)
> 03-05 19:50:56.014: ERROR/dalvikvm(224): pthread_setspecific failed,
> err=22
> 03-05 19:50:56.045: INFO/jdwp(232): received file descriptor 10 from
> ADB
> 03-05 19:50:56.334: DEBUG/AndroidRuntime(232): Shutting down VM
> 03-05 19:50:56.334: WARN/dalvikvm(232): threadid=3: thread exiting
> with uncaught exception (group=0x40010e28)
> 03-05 19:50:56.346: ERROR/AndroidRuntime(232): Uncaught handler:
> thread main exiting due to uncaught exception
> 03-05 19:50:56.364: ERROR/AndroidRuntime(232):
> java.lang.RuntimeException: Unable to start activity ComponentInfo
> {application.main/application.main.Q_end}:
> java.lang.NullPointerException
> 03-05 19:50:56.364: ERROR/AndroidRuntime(232): at
> android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
> 2140)
> 03-05 19:50:56.364: ERROR/AndroidRuntime(232): at
> android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
> 2156)
> 03-05 19:50:56.364: ERROR/AndroidRuntime(232): at
> android.app.ActivityThread.access$1800(ActivityThread.java:112)
> 03-05 19:50:56.364: ERROR/AndroidRuntime(232): at
> android.app.ActivityThread$H.handleMessage(ActivityThread.java:1580)
> 03-05 19:50:56.364: ERROR/AndroidRuntime(232): at
> android.os.Handler.dispatchMessage(Handler.java:88)
> 03-05 19:50:56.364: ERROR/AndroidRuntime(232): at
> android.os.Looper.loop(Looper.java:123)
> 03-05 19:50:56.364: ERROR/AndroidRuntime(232): at
> android.app.ActivityThread.main(ActivityThread.java:3742)
> 03-05 19:50:56.364: ERROR/AndroidRuntime(232): at
> java.lang.reflect.Method.invokeNative(Native Method)
> 03-05 19:50:56.364: ERROR/AndroidRuntime(232): at
> java.lang.reflect.Method.invoke(Method.java:515)
> 03-05 19:50:56.364: ERROR/AndroidRuntime(232): at
> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
> (ZygoteInit.java:739)
> 03-05 19:50:56.364: ERROR/AndroidRuntime(232): at
> com.android.internal.os.ZygoteInit.main(ZygoteInit.java:497)
> 03-05 19:50:56.364: ERROR/AndroidRuntime(232): at
> dalvik.system.NativeStart.main(Native Method)
> 03-05 19:50:56.364: ERROR/AndroidRuntime(232): Caused by:
> java.lang.NullPointerException
> 03-05 19:50:56.364: ERROR/AndroidRuntime(232): at
> android.view.View.<init>(View.java:1645)
> 03-05 19:50:56.364: ERROR/AndroidRuntime(232): at
> android.widget.TextView.<init>(TextView.java:223)
> 03-05 19:50:56.364: ERROR/AndroidRuntime(232): at
> android.widget.TextView.<init>(TextView.java:217)
> 03-05 19:50:56.364: ERROR/AndroidRuntime(232): at
> android.widget.TextView.<init>(TextView.java:212)
> 03-05 19:50:56.364: ERROR/AndroidRuntime(232): at
> application.main.Q_end.onCreate(Q_end.java:32)
> 03-05 19:50:56.364: ERROR/AndroidRuntime(232): at
> android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
> 1122)
> 03-05 19:50:56.364: ERROR/AndroidRuntime(232): at
> android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
> 2103)
> 03-05 19:50:56.364: ERROR/AndroidRuntime(232): ... 11 more
> 03-05 19:50:56.374: INFO/Process(51): Sending signal. PID: 232 SIG: 3
> 03-05 19:50:56.405: INFO/dalvikvm(232): threadid=7: reacting to signal
> 3
> 03-05 19:50:56.426: INFO/dalvikvm(232): Wrote stack trace to '/data/
> anr/traces.txt'
> 03-05 19:51:05.897: WARN/ActivityManager(51): Launch timeout has
> expired, giving up wake lock!
> 03-05 19:51:06.215: WARN/ActivityManager(51): Activity idle timeout
> for HistoryRecord{434f0048 {application.main/application.main.Q_end}}
> 03-05 19:51:11.445: DEBUG/dalvikvm(92): GC freed 1510 objects / 75528
> bytes in 219ms
>
> None of the error seems to point to my actual code so I'm not sure how
> to fix it.
>
> On Mar 4, 9:38 pm, Mark Murphy <[email protected]> wrote:
>
> > automerc wrote:
> > > I was wondering how we could add objects such astextviewandradio
> > > buttons to the activity through code and not the XML file and still
> > > have it run correctly. I tried adding a simpletextviewbelow but I
> > > got an error when I tried to run. Can any1 tell me how I could add the
> > >textviewin correctly?
>
> > Could you provide us with the error details from the log? Use adb
> > logcat, Eclipse, or DDMS.
>
> > In particular, it would be useful to know what exception occurred and
> > what line of your source it occurred on.
>
> > --
> > Mark Murphy (a Commons Guy)http://commonsware.com
> > Android Training in Sweden --http://www.sotrium.com/training.php
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" 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-developers?hl=en
-~----------~----~----~----~------~----~------~--~---