You have a NullPointerException on line 252 of page1.java, as
indicated by your stack trace.
On Tue, Nov 2, 2010 at 9:15 AM, titleist wrote:
> Hello,
> I have one question. How can i fill GridView with data from String
> array? My code for adapter is :
> ArrayAdapter adapter2 = new ArrayAdapter(this,
> android.R.layout.simple_list_item_1, tmpx);
> gridview.setAdapter(adapter2);
>
> where tmpx is array with strings.
> But my app crashes, when i want to run activity.
>
> LogCat error log:
>
>
> 11-02 14:14:12.932: DEBUG/dalvikvm(2156): GC_FOR_MALLOC freed 7180
> objects / 664840 bytes in 109ms
> 11-02 14:14:12.952: ERROR/AndroidRuntime(2156): FATAL EXCEPTION: main
> 11-02 14:14:12.952: ERROR/AndroidRuntime(2156):
> java.lang.RuntimeException: Unable to start activity
> ComponentInfo{si.trendnet.android.terra/
> si.trendnet.android.terra.page1}: java.lang.NullPointerException
> 11-02 14:14:12.952: ERROR/AndroidRuntime(2156): at
> android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
> 2663)
> 11-02 14:14:12.952: ERROR/AndroidRuntime(2156): at
> android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
> 2679)
> 11-02 14:14:12.952: ERROR/AndroidRuntime(2156): at
> android.app.ActivityThread.access$2300(ActivityThread.java:125)
> 11-02 14:14:12.952: ERROR/AndroidRuntime(2156): at
> android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
> 11-02 14:14:12.952: ERROR/AndroidRuntime(2156): at
> android.os.Handler.dispatchMessage(Handler.java:99)
> 11-02 14:14:12.952: ERROR/AndroidRuntime(2156): at
> android.os.Looper.loop(Looper.java:123)
> 11-02 14:14:12.952: ERROR/AndroidRuntime(2156): at
> android.app.ActivityThread.main(ActivityThread.java:4627)
> 11-02 14:14:12.952: ERROR/AndroidRuntime(2156): at
> java.lang.reflect.Method.invokeNative(Native Method)
> 11-02 14:14:12.952: ERROR/AndroidRuntime(2156): at
> java.lang.reflect.Method.invoke(Method.java:521)
> 11-02 14:14:12.952: ERROR/AndroidRuntime(2156): at
> com.android.internal.os.ZygoteInit
> $MethodAndArgsCaller.run(ZygoteInit.java:868)
> 11-02 14:14:12.952: ERROR/AndroidRuntime(2156): at
> com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
> 11-02 14:14:12.952: ERROR/AndroidRuntime(2156): at
> dalvik.system.NativeStart.main(Native Method)
> 11-02 14:14:12.952: ERROR/AndroidRuntime(2156): Caused by:
> java.lang.NullPointerException
> 11-02 14:14:12.952: ERROR/AndroidRuntime(2156): at
> si.trendnet.android.terra.page1.onCreate(page1.java:252)
> 11-02 14:14:12.952: ERROR/AndroidRuntime(2156): at
> android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
> 1047)
> 11-02 14:14:12.952: ERROR/AndroidRuntime(2156): at
> android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
> 2627)
> 11-02 14:14:12.952: ERROR/AndroidRuntime(2156): ... 11 more
>
>
> I would be very grateful if anyone could help me.
>
> Regards,
> Tadej
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>
--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy
Android 2.2 Programming Books: http://commonsware.com/books
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en