Android本地视频播放器开发--搜索本地视频(1)
这一章的主要内容是搜索手机本地视频,添加到ListView列表里,每一个表项含有这个视频的缩略图,视频的播放时间,视频的标题,在搜索本地视频(1)中我们先制作搜索功能。
Video.java--视频相关的属性类
[java]
package com.zhangjie.graduation.videopalyer.videofile;
import java.io.Serializable;
import com.zhangjie.graduation.videopalyer.component.LoadedImage;
public class Video implements Serializable{
/**
*
*/
private static final long serialVersionUID = -7920222595800367956L;
private int id;
private String title;
private String album;
private String artist;
private String displayName;
private String mimeType;
private String path;
private long size;
private long duration;
private LoadedImage image;
/**
*
*/
public Video() {
super();
}
/**
* @param id
* @param title
* @param album
* @param artist
* @param displayName
* @param mimeType
* @param data
* @param size
* @param duration
*/
public Video(int id, String title, String album, String artist,
String displayName, String mimeType, String path, long size,
long duration) {
super();
this.id = id;
this.title = title;
this.album = album;
this.artist = artist;
this.displayName = displayName;
this.mimeType = mimeType;
this.path = path;
this.size = size;
this.duration = duration;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getAlbum() {
return album;
}
public void setAlbum(String album) {
this.album = album;
}
public String getArtist() {
return artist;
}
public void setArtist(String artist) {
this.artist = artist;
}
public String getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
public String getMimeType() {
return mimeType;
}
public void setMimeType(String mimeType) {
this.mimeType = mimeType;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public long getSize() {
return size;
}
public void setSize(long size) {
this.size = size;
}
public long getDuration() {
return duration;
}
public void setDuration(long duration) {
this.duration = duration;
}
public LoadedImage getImage(){
return image;
<PRE class=java name="code">
}
public void setImage(LoadedImage image){
this.image = image;
}
}</PRE>
<PRE></PRE>
<P>AbstructProvider.java ---一个接口,来获取搜索的视频的一个集合</P>
<PRE class=java name="code">package com.zhangjie.graduation.videopalyer.videofile;
import java.util.List;
public inte易做图ce AbstructProvider {
public List<Video> getList();
}</PRE>
<P><BR>
VideoProvider.java--- 实现AbstructProvider接口,通过cursor来搜索视频的相关信息</P>
<PRE class=java name="code">package com.zhangjie.graduation.videopalyer.videofile;
import java.util.ArrayList;
import java.util.List;
import android.content.Context;
import android.database.Cursor;
import android.provider.MediaStore;
public class Video
补充:移动开发 , Android ,