- package com.example.yanshishow;
- //电影视频的model类
- public class MMM {
- String name;
- long size;
- String url;
- long duration;
- public String getName1() {
- return name;
- }
- public void setName1(String name) {
- this.name = name;
- }
- public long getSize1() {
- return size;
- }
- public void setSize1(long size) {
- this.size = size;
- }
- public String getUrl1() {
- return url;
- }
- public void setUrl1(String url) {
- this.url = url;
- }
- public long getDuration1() {
- return duration;
- }
- public void setDuration1(long duration) {
- this.duration = duration;
- }
- }
- public List<MMM> getList() {
- List<MMM> list = null;
- if (this != null) {
- Cursor cursor = this.getContentResolver().query(
- MediaStore.Video.Media.EXTERNAL_CONTENT_URI, null, null,
- null, null);
- if (cursor != null) {
- list = new ArrayList<MMM>();
- while (cursor.moveToNext()) {
- int id = cursor.getInt(cursor
- .getColumnIndexOrThrow(MediaStore.Video.Media._ID));
- String title = cursor
- .getString(cursor
- .getColumnIndexOrThrow(MediaStore.Video.Media.TITLE));
- String album = cursor
- .getString(cursor
- .getColumnIndexOrThrow(MediaStore.Video.Media.ALBUM));
- String artist = cursor
- .getString(cursor
- .getColumnIndexOrThrow(MediaStore.Video.Media.ARTIST));
- String displayName = cursor
- .getString(cursor
- .getColumnIndexOrThrow(MediaStore.Video.Media.DISPLAY_NAME));
- String mimeType = cursor
- .getString(cursor
- .getColumnIndexOrThrow(MediaStore.Video.Media.MIME_TYPE));
- String path = cursor
- .getString(cursor
- .getColumnIndexOrThrow(MediaStore.Video.Media.DATA));
- long duration = cursor
- .getInt(cursor
- .getColumnIndexOrThrow(MediaStore.Video.Media.DURATION));
- long size = cursor
- .getLong(cursor
- .getColumnIndexOrThrow(MediaStore.Video.Media.SIZE));
- MMM video = new MMM();
- video.setName1(title);
- video.setSize1(size);
- video.setUrl1(path);
- video.setDuration1(duration);
- list.add(video);
- }
- cursor.close();
- }
- }
- return list;
- }