yixia / VitamioBundle

Vitamio for Android
http://www.vitamio.org/en/
Other
5.27k stars 2.07k forks source link

how to use VideoView in GridView? #414

Open ghost opened 8 years ago

ghost commented 8 years ago

how to use VideoView in GridView? when i create a GridView, and every item is a VideoView, but it don't work! and the logcat is : 08-19 13:23:28.594 21737-21737/com.example.android.basicmediadecoder E/dalvikvm: Could not find class 'android.os.PersistableBundle', referenced from method com.example.android.basicmediadecoder.MainActivity.access$super 08-19 13:23:28.594 21737-21737/com.example.android.basicmediadecoder E/dalvikvm: Could not find class 'android.os.PersistableBundle', referenced from method com.example.android.basicmediadecoder.MainActivity.access$super 08-19 13:23:28.594 21737-21737/com.example.android.basicmediadecoder E/dalvikvm: Could not find class 'android.media.session.MediaController', referenced from method com.example.android.basicmediadecoder.MainActivity.access$super 08-19 13:23:28.594 21737-21737/com.example.android.basicmediadecoder E/dalvikvm: Could not find class 'android.widget.Toolbar', referenced from method com.example.android.basicmediadecoder.MainActivity.access$super 08-19 13:23:28.604 21737-21737/com.example.android.basicmediadecoder E/dalvikvm: Could not find class 'android.app.ActivityManager$TaskDescription', referenced from method com.example.android.basicmediadecoder.MainActivity.access$super 08-19 13:23:28.614 21737-21737/com.example.android.basicmediadecoder E/dalvikvm: Could not find class 'android.app.SharedElementCallback', referenced from method com.example.android.basicmediadecoder.MainActivity.access$super 08-19 13:23:28.614 21737-21737/com.example.android.basicmediadecoder E/dalvikvm: Could not find class 'android.os.PersistableBundle', referenced from method com.example.android.basicmediadecoder.MainActivity.access$super 08-19 13:23:28.624 21737-21737/com.example.android.basicmediadecoder E/dalvikvm: Could not find class 'android.app.SharedElementCallback', referenced from method com.example.android.basicmediadecoder.MainActivity.access$super 08-19 13:23:28.624 21737-21737/com.example.android.basicmediadecoder E/dalvikvm: Could not find class 'android.app.assist.AssistContent', referenced from method com.example.android.basicmediadecoder.MainActivity.access$super 08-19 13:23:28.634 21737-21737/com.example.android.basicmediadecoder E/dalvikvm: Could not find class 'android.view.SearchEvent', referenced from method com.example.android.basicmediadecoder.MainActivity.access$super 08-19 13:23:28.644 21737-21737/com.example.android.basicmediadecoder E/dalvikvm: Could not find class 'android.os.PersistableBundle', referenced from method com.example.android.basicmediadecoder.MainActivity.access$super 08-19 13:23:28.804 21737-21737/com.example.android.basicmediadecoder E/dalvikvm: Could not find class 'android.view.ViewOutlineProvider', referenced from method io.vov.vitamio.widget.VideoView.access$super 08-19 13:23:28.814 21737-21737/com.example.android.basicmediadecoder E/dalvikvm: Could not find class 'android.animation.StateListAnimator', referenced from method io.vov.vitamio.widget.VideoView.access$super 08-19 13:23:28.814 21737-21737/com.example.android.basicmediadecoder E/dalvikvm: Could not find class 'android.view.View$OnApplyWindowInsetsListener', referenced from method io.vov.vitamio.widget.VideoView.access$super 08-19 13:23:28.814 21737-21737/com.example.android.basicmediadecoder E/dalvikvm: Could not find class 'android.view.ViewStructure', referenced from method io.vov.vitamio.widget.VideoView.access$super 08-19 13:23:28.824 21737-21737/com.example.android.basicmediadecoder E/dalvikvm: Could not find class 'android.view.View$OnContextClickListener', referenced from method io.vov.vitamio.widget.VideoView.access$super 08-19 13:23:28.834 21737-21737/com.example.android.basicmediadecoder E/dalvikvm: Could not find class 'android.view.WindowInsets', referenced from method io.vov.vitamio.widget.VideoView.access$super 08-19 13:23:28.834 21737-21737/com.example.android.basicmediadecoder E/dalvikvm: Could not find class 'android.view.View$OnScrollChangeListener', referenced from method io.vov.vitamio.widget.VideoView.access$super 08-19 13:23:28.844 21737-21737/com.example.android.basicmediadecoder E/dalvikvm: Could not find class 'android.view.ViewStructure', referenced from method io.vov.vitamio.widget.VideoView.access$super 08-19 13:23:28.844 21737-21737/com.example.android.basicmediadecoder E/dalvikvm: Could not find class 'android.view.ViewStructure', referenced from method io.vov.vitamio.widget.VideoView.access$super 08-19 13:23:28.844 21737-21737/com.example.android.basicmediadecoder E/dalvikvm: Could not find class 'android.view.WindowInsets', referenced from method io.vov.vitamio.widget.VideoView.access$super 08-19 13:23:28.854 21737-21737/com.example.android.basicmediadecoder E/dalvikvm: Could not find class 'android.view.WindowInsets', referenced from method io.vov.vitamio.widget.VideoView.access$super 08-19 13:23:28.914 21737-21737/com.example.android.basicmediadecoder E/dalvikvm: Could not find class 'android.view.ViewOutlineProvider', referenced from method io.vov.vitamio.widget.MediaController.access$super 08-19 13:23:28.914 21737-21737/com.example.android.basicmediadecoder E/dalvikvm: Could not find class 'android.animation.StateListAnimator', referenced from method io.vov.vitamio.widget.MediaController.access$super 08-19 13:23:28.924 21737-21737/com.example.android.basicmediadecoder E/dalvikvm: Could not find class 'android.view.View$OnApplyWindowInsetsListener', referenced from method io.vov.vitamio.widget.MediaController.access$super 08-19 13:23:28.924 21737-21737/com.example.android.basicmediadecoder E/dalvikvm: Could not find class 'android.view.ViewStructure', referenced from method io.vov.vitamio.widget.MediaController.access$super 08-19 13:23:28.934 21737-21737/com.example.android.basicmediadecoder E/dalvikvm: Could not find class 'android.view.View$OnContextClickListener', referenced from method io.vov.vitamio.widget.MediaController.access$super 08-19 13:23:28.944 21737-21737/com.example.android.basicmediadecoder E/dalvikvm: Could not find class 'android.view.WindowInsets', referenced from method io.vov.vitamio.widget.MediaController.access$super 08-19 13:23:28.944 21737-21737/com.example.android.basicmediadecoder E/dalvikvm: Could not find class 'android.view.View$OnScrollChangeListener', referenced from method io.vov.vitamio.widget.MediaController.access$super 08-19 13:23:28.954 21737-21737/com.example.android.basicmediadecoder E/dalvikvm: Could not find class 'android.view.ViewStructure', referenced from method io.vov.vitamio.widget.MediaController.access$super 08-19 13:23:28.954 21737-21737/com.example.android.basicmediadecoder E/dalvikvm: Could not find class 'android.view.ViewStructure', referenced from method io.vov.vitamio.widget.MediaController.access$super 08-19 13:23:28.954 21737-21737/com.example.android.basicmediadecoder E/dalvikvm: Could not find class 'android.view.WindowInsets', referenced from method io.vov.vitamio.widget.MediaController.access$super 08-19 13:23:28.964 21737-21737/com.example.android.basicmediadecoder E/dalvikvm: Could not find class 'android.view.WindowInsets', referenced from method io.vov.vitamio.widget.MediaController.access$super 08-19 13:23:29.234 21737-21737/com.example.android.basicmediadecoder E/Vitamio[4.2.6][Player]: FIND_NAME_SYM vvo, render_yuv

superpowermanyob commented 5 years ago
GridView mListview;
CustomAdapter mAdapter;

protected void onCreate(Bundle savedInstanceState) { mListview = (GridView) findViewById(R.id.pager); mListview.setOnItemClickListener(this); mAdapter = new CustomAdapter(this); mListview.setAdapter(mAdapter); } private class CustomAdapter extends BaseAdapter { Context mContext; CustomAdapter(Context _context){ mContext = _context; } @Override public int getCount() { return mVideoArrayList.size(); }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @SuppressLint("WrongViewCast")
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        if(convertView == null)
        {
            convertView = LayoutInflater.from(getApplicationContext()).inflate(R.layout.content_video_list, null);
            VideoView videoView = convertView.findViewById(R.id.videoview);
            videoView.setVideoPath(path);
        }
        return convertView;
    }
}