Alright, I solved the problem by moving all view element out of
OnCreate();

On Feb 5, 9:04 am, Mystique <[email protected]> wrote:
> Hi,
>
> I have a listview and is working good but i realize if I do a screen
> orientation change it will crash. Why is that so?
>
> Many thanks.
>
> ---
> 02-05 01:04:41.208: ERROR/AndroidRuntime(14593): FATAL EXCEPTION: main
> 02-05 01:04:41.208: ERROR/AndroidRuntime(14593):
> java.lang.NullPointerException
> 02-05 01:04:41.208: ERROR/AndroidRuntime(14593):     at
> android.widget.SimpleAdapter.getCount(SimpleAdapter.java:93)
> 02-05 01:04:41.208: ERROR/AndroidRuntime(14593):     at
> android.widget.AdapterView.checkFocus(AdapterView.java:689)
> 02-05 01:04:41.208: ERROR/AndroidRuntime(14593):     at
> android.widget.AdapterView
> $AdapterDataSetObserver.onInvalidated(AdapterView.java:813)
> 02-05 01:04:41.208: ERROR/AndroidRuntime(14593):     at
> android.database.DataSetObservable.notifyInvalidated(DataSetObservable.java :
> 43)
> 02-05 01:04:41.208: ERROR/AndroidRuntime(14593):     at
> android.widget.BaseAdapter.notifyDataSetInvalidated(BaseAdapter.java:
> 54)
> 02-05 01:04:41.208: ERROR/AndroidRuntime(14593):     at
> android.widget.SimpleAdapter
> $SimpleFilter.publishResults(SimpleAdapter.java:383)
> 02-05 01:04:41.208: ERROR/AndroidRuntime(14593):     at
> android.widget.Filter$ResultsHandler.handleMessage(Filter.java:282)
> 02-05 01:04:41.208: ERROR/AndroidRuntime(14593):     at
> android.os.Handler.dispatchMessage(Handler.java:99)
> 02-05 01:04:41.208: ERROR/AndroidRuntime(14593):     at
> android.os.Looper.loop(Looper.java:123)
> 02-05 01:04:41.208: ERROR/AndroidRuntime(14593):     at
> android.app.ActivityThread.main(ActivityThread.java:4627)
> 02-05 01:04:41.208: ERROR/AndroidRuntime(14593):     at
> java.lang.reflect.Method.invokeNative(Native Method)
> 02-05 01:04:41.208: ERROR/AndroidRuntime(14593):     at
> java.lang.reflect.Method.invoke(Method.java:521)
> 02-05 01:04:41.208: ERROR/AndroidRuntime(14593):     at
> com.android.internal.os.ZygoteInit
> $MethodAndArgsCaller.run(ZygoteInit.java:868)
> 02-05 01:04:41.208: ERROR/AndroidRuntime(14593):     at
> com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
> 02-05 01:04:41.208: ERROR/AndroidRuntime(14593):     at
> dalvik.system.NativeStart.main(Native Method)

-- 
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

Reply via email to