How i can set Error on a Listview
I have studied this about ListView :
ListView component did not render element on position that is hidden ib
scroll. It is a lazy component that renders only what is on screen.
So how could i put error on the items of the ListView .If i am using
setError it is working fine for the items that are visible on screen so
could set error on that part that is not visible.
I am trying to set error like this
View myView = listView.getChildAt(position);
TextView textView=(TextView)myView.findViewById(android.R.id.text1);
textView.setError(error);
Exception is
08-23 11:20:47.385: E/AndroidRuntime(2931): FATAL EXCEPTION: main
08-23 11:20:47.385: E/AndroidRuntime(2931): java.lang.NullPointerException
08-23 11:20:47.385: E/AndroidRuntime(2931): at
com.example.iweenflightbookingpage.MainActivity$1.onClick(MainActivity.java:118)
08-23 11:20:47.385: E/AndroidRuntime(2931): at
android.view.View.performClick(View.java:4091)
08-23 11:20:47.385: E/AndroidRuntime(2931): at
android.view.View$PerformClick.run(View.java:17072)
08-23 11:20:47.385: E/AndroidRuntime(2931): at
android.os.Handler.handleCallback(Handler.java:615)
08-23 11:20:47.385: E/AndroidRuntime(2931): at
android.os.Handler.dispatchMessage(Handler.java:92)
08-23 11:20:47.385: E/AndroidRuntime(2931): at
android.os.Looper.loop(Looper.java:153)
08-23 11:20:47.385: E/AndroidRuntime(2931): at
android.app.ActivityThread.main(ActivityThread.java:4987)
08-23 11:20:47.385: E/AndroidRuntime(2931): at
java.lang.reflect.Method.invokeNative(Native Method)
08-23 11:20:47.385: E/AndroidRuntime(2931): at
java.lang.reflect.Method.invoke(Method.java:511)
08-23 11:20:47.385: E/AndroidRuntime(2931): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:821)
08-23 11:20:47.385: E/AndroidRuntime(2931): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584)
08-23 11:20:47.385: E/AndroidRuntime(2931): at
dalvik.system.NativeStart.main(Native Method)
No comments:
Post a Comment