List view scroll issue

by Muthu Kumar K. » Wed, 29 Apr 2009 16:39:30 GMT


Sponsored Links
 Hi All,

I have developed an android application which is having list views.
Here i have two different pages (list view), which is having 6 and 150
list items. Right now i am in second page. It is having the 150 items.
Now i am scrolling the page, at the same time i am trying to navigate
different or previous page using the button action. That time I am
getting the crash. That means ArrayIndexOutOfBoundsException i am
getting. I am using the custom adapter to create list menu. Here is my
code,

private class CustomListAdapter extends BaseAdapter {
                Context context;
                public CustomListAdapter(Context context) {
                        this.context = context;
                }
                public int getCount() {
                        return toDisplay.length;
                }
                public Object getItem(int arg0) {
                        return toDisplay[arg0];
                }
                public long getItemId(int position) {
                        return 0;
                }
                public View getView(int position, View convertView, ViewGroup
parent) {
                        CustomListView view = null;

                        /*
                         My code here...
                         */
                        view = new CustomListView(context, sType, bmImg, 
position);
                        view.setGravity(Gravity.CENTER);
                        }
                        return view;
                }
        }

While coming navigating i am getting the problem in the following line
"public View getView(int position, View convertView, ViewGroup
parent)"
because I am getting the position value as greater than 6. So can any
one tell me how to resolve this.
I think the problem in list view scrolling. So before navigating to
other screen i have to stop the scrolling. How to do that?
Please let me know your suggestions.

Thanks in Advance,
Muthu Kumar K.
--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Switching from Landscape to Portrait orientation

U can find the code snippet for this orientation of screen  portrait view to
landscape view..........
http://www.anddev.org/index.php?sid=073eab2a58d6440d349e502239240872


see this link it may be useful for u .......






-- 
Regards
-------------------
Desu Vinod Kumar
vinny.s...@gmail.com
09916009493

--~--~---------~--~----~------------~-------~--~----~

2. any way to debug the service in system_server?

Resent, it seems that the thread to android-discuss is lost.

---------- Forwarded message ----------
From: Chen Yang <sunsety...@gmail.com>
Date: Fri, Apr 3, 2009 at 11:44 AM
Subject: any way to debug the service in system_server?
To: android-disc...@googlegroups.com


I don't know whether this is the right forum for this thread. I am
interested to know how to debug those services in system server, is
there some known good approaches? Thanks.
--
Chen

--~--~---------~--~----~------------~-------~--~----~

3. adb ppp

4. UI improvements in next versions.

5. 3D UI framework like clutter on android

6. HTMLViewer

7. how to get focus in AlarmClock