Android FileProvider无法与Google+照片配合使用

时间:2016-03-24 11:23:28

标签: android cursor android-contentprovider android-fileprovider

我尝试使用FileProvider方式使用Intents显示图像。基本设置如下:

Uri contentUri = FileProvider.getUriForFile(getContext(), "my.domain.fileprovider", file);
Intent i = new Intent();
i.setAction(android.content.Intent.ACTION_VIEW);
i.setDataAndType(contentUri, "image/*");
i.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivityForResult(i, Activity.RESULT_OK);

使用" Gallery"它正常工作。 app但是"照片" (Google+)崩溃:

03-24 11:55:32.390 499-1488/? E/CursorWindow: Failed to read row 0, column 0 from a CursorWindow which has 1 rows, 0 columns.
03-24 11:55:32.400 499-1488/? E/EsAppStartupListener: Uncaught exception in background thread Thread[ImageLoader,5,main]
                                                      java.lang.IllegalStateException: Couldn't read row 0, col 0 from CursorWindow.  Make sure the Cursor is initialized correctly before accessing data from it.
                                                          at android.database.CursorWindow.nativeGetString(Native Method)
                                                          at android.database.CursorWindow.getString(CursorWindow.java:451)
                                                          at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:51)
                                                          at android.database.CursorWrapper.getString(CursorWrapper.java:114)
                                                          at mzi.a(PG:103)
                                                          at jhc.t(PG:1399)
                                                          at jhc.c(PG:1376)
                                                          at ksw.handleMessage(PG:293)
                                                          at android.os.Handler.dispatchMessage(Handler.java:98)
                                                          at android.os.Looper.loop(Looper.java:145)
                                                          at android.os.HandlerThread.run(HandlerThread.java:61)
                                                          at ksw.run(PG:280)
03-24 11:55:32.400 499-499/? E/AndroidRuntime: FATAL EXCEPTION: ImageLoader
                                               Process: com.google.android.apps.plus, PID: 499
                                               java.lang.IllegalStateException: Couldn't read row 0, col 0 from CursorWindow.  Make sure the Cursor is initialized correctly before accessing data from it.
                                                   at android.database.CursorWindow.nativeGetString(Native Method)
                                                   at android.database.CursorWindow.getString(CursorWindow.java:451)
                                                   at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:51)
                                                   at android.database.CursorWrapper.getString(CursorWrapper.java:114)
                                                   at mzi.a(PG:103)
                                                   at jhc.t(PG:1399)
                                                   at jhc.c(PG:1376)
                                                   at ksw.handleMessage(PG:293)
                                                   at android.os.Handler.dispatchMessage(Handler.java:98)
                                                   at android.os.Looper.loop(Looper.java:145)
                                                   at android.os.HandlerThread.run(HandlerThread.java:61)
                                                   at ksw.run(PG:280)

这是一个已知问题还是我做错了什么?

0 个答案:

没有答案