开发者

how to bind the adapter list content of click event

friend's i have listview with 10 records parsed initially from internet and i have footer at bottom of my listview by using for click more to view,the view getting ok but the problem here is during my click event i have to call the same adapter class with different url it getting parsed well,the problem is click event adapter data are not binded with listview,i'm getting error has like this..

09-02 21:02:15.042: ERROR/AndroidRuntime(424): java.lang.IndexOutOfBoundsException: Invalid location 58, size is 1 09-02 21:02:15.042: ERROR/AndroidRuntime(424): at java.util.ArrayList.get(ArrayList.java:353)

here my java code initially executing....

LayoutInflater inflater2 = this.getLayoutInflater();
        View footerView = inflater2.inflate(R.layout.footer, null);
        footerView.findViewById(R.id.text1);

//      ((ListView) adapter).

    //  setListAdapter(adapter);

        adapter = new Adapter(Expand.this,url);
        getListView().addFooterView(footerView);    
        setListAdapter(adapter);

code at my footer click event ...

footerView.findViewById(R.id.text1).setOnClickListener(new OnClickListener(){
        @Override
        public void onClick(View arg0) {
            // TODO Auto-generated method stub

//

int  a = adapter.count;
                    len =100;
//   开发者_StackOverflow社区               Log.v("Count",Integer.toString(a));
                    url = "http://www.artistdirect.com/nad/rss/top100/0,,,00.xml";
                    adapter = new Adapter(Expand.this,url);
    adapter.notifyDataSetChanged();
}

how can i resolve it,is there any otherway to place link to view more and bind it on listview.

Thanks in advance.


I think that url is invalid...or it will return null values, check your url...


Call getListView().addFooterView(footerView); before calling setAdapter. This is so ListView can wrap the supplied cursor with one that will also account for header and footer views.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜