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. Tidak bisa post

Permisi gan
Mau tanya, kog saya tidak bisa post n repp di milis ini yak?
Apa memang saya ada buat salah atau gimana yak?


Trims,
Sent from my BlackBerry smartphone from Sinyal Bagus XL, Nyambung Teruuusss...!

-- 
"Indonesian Android Community [id-android]" 

2. OpenGL ES 2.0 on Eclair

Eclair has supported OpenGL ES 2.0. But I can not find related JNI
wrapper for OpenGL ES API. How a Java application use OpenGL ES 2.0
functions?

-- 

3. warn about autorun.inf on the sdcar

4. how to crop an image in android 2.x

5. cara partisi N1

6. (WTA) Kembaliin ukuran sd card bekas partisi

7. Kartu Indosat dgn nomer 0814 yg kemarin beli di Expo