这应该是一个简单的任务,但由于某种原因,我可以找到一种方法来设置DialogFragment的标题.(我正在使用onCreateView重载设置对话框内容).
默认样式为标题留下了一个位置,但我找不到DialogFragment类的任何方法来设置它.
当该onCreateDialog方法用于设置内容时,标题以某种方式神奇地设置,所以我想知道这是否是设计,或者在使用onCreateView重载时有一个特殊的技巧来设置它.
似乎API级别13(据我所知,"默默地")引入了对android:configChanges属性的处理方式的更改.
在我的特定情况下,当应用程序清单中的"targetSdkVersion"设置为"13"时,任何配置为内部处理方向更改的活动(例如,不应在屏幕旋转时重新启动)都将始终重新启动,而不管android:configChanges =声明中的"orientation"属性.
将"targetSdkVersion"简单地切换为"12"可恢复预期的行为.
我搜索了API 13发行说明,但没有找到任何关于此类更改的提及.有谁知道API 13(以及可能更晚的API)是否会设计不支持android:configChanges ="orientation",或者是否有另一种方法来实现这一点.
我一直在尝试在StrictMode中运行我的应用程序来检查可能已经潜入的任何隐藏问题.我遇到的一个问题是使用ContentResolver时泄漏的DatabaseConections似乎是误报.
经过一些实验后,问题简化为以下2行代码:
Cursor c = context.getContentResolver().query(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, cols, null, null, MediaStore.Video.Media.DEFAULT_SORT_ORDER);
c.close()
Run Code Online (Sandbox Code Playgroud)
上面的2行生成以下StrictMode违规:
ERROR/StrictMode(26219): Releasing cursor in a finalizer. Please ensure that you explicitly call close() on your cursor:
ERROR/StrictMode(26219): android.database.sqlite.DatabaseObjectNotClosedException: Application did not close the cursor or database object that was opened here
ERROR/StrictMode(26219):
at android.database.CursorWindow.<init>(CursorWindow.java:62)
at android.content.ContentProviderProxy.query(ContentProviderNative.java:403)
at android.content.ContentResolver.query(ContentResolver.java:302)
Run Code Online (Sandbox Code Playgroud)
我假设这是特定于Cursor由contentProvider返回的事实(因此它不是直接的SQLite游标).
有没有人有任何见解,如果这确实是一个误报或实际上是一个漏洞的光标.
android ×3