开发者

Listview items appearing in wrong order

I am having an unusual problem with my listview. I have a listview with a list of video files stored on the SD card al开发者_JS百科ong with a play button. When I click on the play button, a separate activity is created using Intent and when the application comes back to the original application, my whole list is reversed. I am using the following code.. (not complete code)

String[] vlist = { MediaStore.Video.Media._ID,
            MediaStore.Video.Media.DATA,
            MediaStore.Video.Media.DISPLAY_NAME,
            MediaStore.Video.Media.SIZE };
    videocursor = managedQuery(MediaStore.Video.Media.EXTERNAL_CONTENT_URI,
                               vlist, null, null, null);


    int v_count= videocursor.getCount();
    String[] videolist = new String[v_count];

    list=(ListView)findViewById(R.id.list);
    adapter=new MainAdapter(this,videolist, videocursor); //sending parameters to MainAdapter. 
    list.setAdapter(adapter);
    //list.setOnItemClickListener(MainActivity.this); 
    list.setOnTouchListener(gestureListener);   

I don't know whats wrong.. Any suggestions??


I faced the same issue , and removed notifyDataSetChanged(); in adapter class within if-else and then my items in the listview were in the order i wanted it to be.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜