我想以编程方式移动,复制和删除SD卡上的文件和目录.我已经完成了谷歌搜索,但找不到任何有用的东西.
我已经使用了这段代码,并且可以通过我的Android应用程序成功地将图像(来自我手机的图库)与文本分享到谷歌+.
但是,当我尝试从我的应用内容提供商发布图片时,图片会显示在我的Google +页面上,就像这样......

...即使在谷歌+应用预览屏幕上显示的预期图像很好.
我用来分享的代码是:
String message = "My message";
Uri localImageUri = ContentUris.withAppendedId(DbContentProvider.CONTENT_URI_PRODUCTS, mProductId;
PlusShare.Builder builder = new PlusShare.Builder(getActivity());
builder.setText(message);
builder.addStream(localImageUri);
builder.setType("image/jpeg");
Intent shareIntent = builder.getIntent();
startActivityForResult(shareIntent, RC_GOOGLE_PLUS);
Run Code Online (Sandbox Code Playgroud)
...而且,就像我说的,如果localImageUri值是针对我手机图库中的资源,则图像会成功显示在最终的Google +页面上 - 如果我localImageUri从应用程序自己的内容提供商设置为uri,则显示上面的占位符图像.
所以我认为我的内容提供商一定存在问题,我的清单中将其定义为:
<provider
android:name=".DbContentProvider"
android:authorities="com.example.provider"
android:exported="true"
android:grantUriPermissions="true" />
Run Code Online (Sandbox Code Playgroud)
那么,我的清单中是否会遗漏一些东西 - 甚至是我的searchable.xml文件:
<?xml version="1.0" encoding="utf-8"?>
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
android:label="@string/app_name"
android:hint="@string/search_hint"
android:searchSuggestAuthority="com.example.provider"
android:searchSuggestIntentAction="android.intent.action.VIEW"
android:searchSuggestIntentData="content://com.example.provider/suggest"
android:searchSuggestThreshold="3"
android:includeInGlobalSearch="true"
android:searchSettingsDescription="@string/search_settings_description"
android:queryAfterZeroResults="true"
android:voiceSearchMode="showVoiceSearchButton" >
</searchable>
Run Code Online (Sandbox Code Playgroud)
如果没有,那么问题是什么呢?
更新(遵循CommonsWare的评论)
异常确实是由Google+信息库抛出,因为也做在查询_data栏(其存在),借助Google+ API,也一直在寻找一个不存在的列-即datetaken,date_added,date_modified.
所以我已经将这些列添加到我的数据库表中 …