Android 用于将视频片段转换为ListView的自定义阵列适配器

Android 用于将视频片段转换为ListView的自定义阵列适配器,android,listview,android-fragments,android-videoview,Android,Listview,Android Fragments,Android Videoview,我正在尝试制作一个自定义阵列适配器,以便在列表视图中显示视频。据我所知,适配器用于遍历数组并在预定义的布局中显示其内容。我已经为一个标准的字符串数组适配器工作了,但是我的自定义适配器似乎甚至没有显示出来 这是我的密码: @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.

我正在尝试制作一个自定义阵列适配器,以便在列表视图中显示视频。据我所知,适配器用于遍历数组并在预定义的布局中显示其内容。我已经为一个标准的字符串数组适配器工作了,但是我的自定义适配器似乎甚至没有显示出来

这是我的密码:

@Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View v = inflater.inflate(R.layout.list_fragment, container, false);
        Bundle args = getArguments(); 
        int[] vids = args.getIntArray("vids"); //array of video resources
        //will convert items from aray into a list
        ListView story = (ListView) v;
        ListAdapter vid_view = new ListItemAdapter(getActivity(),foods);
        story.setAdapter(vid_view); //seems not to be loading anything

        return v;
    }

    public static list_page newInstance(int[] vids) {
        list_page page = new list_page();
        Bundle args = new Bundle();
        args.putIntArray("vids", vids);
        page.setArguments(args);

        return page;
    }
我的自定义适配器

private int[]vid_array;

    public ListItemAdapter(Context context, int[] vids) {
        super(context, R.layout.video_fragment,vids);
        this.vid_array = vids; //sets the array to video resource array
    }

    @Override
    public View getView(int pos, View convertView, ViewGroup parent){
        LayoutInflater vid_inflater = LayoutInflater.from(getContext());
        View custom = vid_inflater.inflate(R.layout.video_fragment, parent, false);

        VideoView videoView = (VideoView) custom.findViewById(R.id.vid_view);
        String pack = getContext().getApplicationContext().getPackageName();
        Uri video_res = Uri.parse("android.resource://" + pack + "/" + vid_array[pos]);
        System.out.println("Video Resource: "+ vid_array[pos]); //I don't even see this in the console log
        videoView.setVideoURI(video_res);
        videoView.start();
        TextView vidText = (TextView) custom.findViewById(R.id.textView3);
        vidText.setText(vid_array[pos]);

        return custom;
    }

我是android新手,我不确定我在哪里弄乱了这个适配器。我应该如何将视频资源加载到一个数组中,由适配器解析并放入列表中?

你得到答案了吗?我和你有同样的问题。