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

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, 
                        return view;

While coming navigating i am getting the problem in the following line
"public View getView(int position, View convertView, ViewGroup
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. How much does an Nexus One cost?

I am thinking of joining the android developers network. However, I cannot seem to find out how much the hardware development tools cost. Can someone please tell me how much an Android dev phone costs? Thanks, Chuck --

2. VideoView not playing sample video on T-Mobile G2 (Just audio)

Found the problem! In my case it was because I was specifying a
background colour for the VideoView which was being rendered over the
top of the video, which was playing perfectly! lol

See here:


3. getting SocketTimeOutException

4. Stop execution of an activity after startActivityForResult() and setResult

5. change fonts

6. Android Application Development India, Houston, London

7. Android Games Development - India