luk*_*kin 5 android image gallery android-contentprovider
我想在Android中创建一个新的"专辑".我理解你必须使用自己的ContentProvider.但我无法弄清楚如何.如果您拍照,所有图像都会出现在相册'相机'中.如果您已安装Google+,则会看到2张额外相册:即时上传和个人资料图片.
我们想要创造类似的东西.我们在线有一个用户专辑,我们希望它在Gallery应用中显示为专辑项目.有人能指出我正确的方向.
我已经检查过:http://developer.android.com/guide/topics/providers/content-providers.html
其实我不确定是否有可能.
您可以使用这种方式在Gallery应用中创建相册.该名称显示为"app images".
String path = Environment.getExternalStorageDirectory().toString();
File dir = new File(path, "/appname/media/app images/");
if (!dir.isDirectory()) {
dir.mkdirs();
}
File file = new File(dir, filename + ".jpg");
String imagePath = file.getAbsolutePath();
//scan the image so show up in album
MediaScannerConnection.scanFile(this,
new String[] { imagePath }, null,
new MediaScannerConnection.OnScanCompletedListener() {
public void onScanCompleted(String path, Uri uri) {
if(Config.LOG_DEBUG_ENABLED) {
Log.d(Config.LOGTAG, "scanned : " + path);
}
}
});
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
11404 次 |
最近记录: |