我正在为Dropbox编写DocumentsProvider.我正在尝试遵循Google指南创建自定义提供程序,以及Ian Lake 在Medium上发布的相同内容.
我试图在存储访问框架中包含该功能,其中一个表明有更多数据要加载.
queryChildDocuments()方法的相关部分如下所示:
@Override
public Cursor queryChildDocuments(final String parentDocumentId,
final String[] projection,
final String sortOrder) {
if (selfPermissionsFailed(getContext())) {
// Permissions have changed, abort!
return null;
}
// Create a cursor with either the requested fields, or the default projection if "projection" is null.
final MatrixCursor cursor = new MatrixCursor(projection != null ? projection : getDefaultDocumentProjection()){
// Indicate we will be batch loading
@Override
public Bundle getExtras() {
Bundle bundle = new Bundle(); …
Run Code Online (Sandbox Code Playgroud) storage android frameworks storage-access-framework dropbox-sdk-js
Update: I've changed the title to remove the indication that ExoPlayer has anything to do with what is going on as I've managed to duplicate this without it being used at all.
I decided to try and isolate this error on API levels:
I obtained an older Samsung tablet (Tab S2) running Android 7.0 (Api 24), and the error does not occur there.
I am not able to duplicate this problem on a Nexus 6 emulator using API 25
I …
nosuchmethoderror android-inflate layout-inflater android-studio android-typeface
我有一个使用非常常见的设计模式的Android应用程序:
在这两种情况下,都只允许用户从局部片段进行编辑。
我目前在应用程序类中初始化了我的领域实例,然后在我用来保存一些内部管理方法的活动基类中检索了默认实例:
public abstract class SingleFragmentActivity extends AppCompatActivity {
private Realm realm;
protected abstract Fragment createFragment();
@LayoutRes
protected int getLayoutResId() {
return R.layout.activity_fragment;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
realm = Realm.getDefaultInstance();
// Initialize ProfileLab
ProfileLab.get(realm);
setContentView(getLayoutResId());
FragmentManager fm = getSupportFragmentManager();
Fragment fragment = fm.findFragmentById(R.id.fragment_container);
if (fragment == null) {
fragment = createFragment();
fm.beginTransaction()
.add(R.id.fragment_container, fragment)
.commit();
}
}
@Override
protected void onDestroy() {
super.onDestroy();
if ( realm != null) {
realm.close();
}
}
} …
Run Code Online (Sandbox Code Playgroud) 我使用 Android Studio 4.2.2 中的记录器记录了一个 Espresso 测试,其中包括一个断言,即我的 MainActivity UI 上的文本字段显示了正确的文本字符串。然后我将其保存到 SplashActivityTest.java:
公共类 SplashActivityTest {
@Rule
public ActivityTestRule<SplashActivity> mActivityTestRule = new ActivityTestRule<>(SplashActivity.class);
@Before
public void registerIdlingResource() {
IdlingRegistry.getInstance().register(CountingIdlingResourceSingleton.espressoIdlingResource);
}
@After
public void unregisterIdlingResource() {
IdlingRegistry.getInstance().unregister(CountingIdlingResourceSingleton.espressoIdlingResource);
}
@Test
public void splashActivityTest() {
ViewInteraction textView = onView(
allOf(withId(R.id.playlistText), withText("My Playlists"),
withParent(withParent(withId(R.id.nav_host_fragment))),
isDisplayed()));
textView.check(matches(isDisplayed()));
ViewInteraction textView2 = onView(
allOf(withId(R.id.playlistText), withText("My Playlists"),
withParent(withParent(withId(R.id.nav_host_fragment))),
isDisplayed()));
textView2.check(matches(withText("My Playlists")));
}
Run Code Online (Sandbox Code Playgroud)
}
我向此类添加了 Idling 注册表的使用,因为在我的应用程序中,实际发生的启动画面是启动器活动,然后启动加载我想要测试的 UI 的活动。
我有这个代码:
// Necessary for automated tests, decrement handled in MainActivity.onResume()
CountingIdlingResourceSingleton.increment();
Run Code Online (Sandbox Code Playgroud)
在 …
automated-tests android-espresso android-junit android-espresso-recorder
我有一个在Realm 5.7.0下构建并运行良好的Android应用程序.我刚刚将我的gradle升级到5.8.0,并且初始同步很顺利,但是当我尝试将应用程序执行到我的模拟器时,我收到此错误:
com.android.builder.dexing.DexArchiveBuilderException: Failed to process C:\Users\frysingg\.gradle\caches\transforms-1\files-1.1\jetified-realm-android-library-5.8.0.aar\c1094bb66029494e6cdb95ba0999c5a7\jars\classes.jar
com.android.builder.dexing.DexArchiveBuilderException: Error while dexing.
com.android.tools.r8.CompilationFailedException: Compilation failed to complete
com.android.tools.r8.utils.AbortException: Error: Invoke-customs are only supported starting with Android O (--min-api 26)
Run Code Online (Sandbox Code Playgroud)
执行干净,重建,清除Android Studio缓存并重新启动无济于事.回到5.7.0呢.
为了使用5.8.0,我还需要做些什么吗?
我最近升级到 Android Studio 4.1。现在,AS 经常会认为它不知道“R”是什么,特别是仅在特定资源 ID 上:com.google.android.material.R.id.snackbar_text
我想我记得在某处读到这些资源 ID 已更改为不再声明为“最终”,但我不清楚为什么或是否会导致此问题。
使缓存无效并重新启动可以暂时“修复”此问题,但随后又会出现这种情况。所有类型的清理、重建项目等均无效。
我使用此资源动态获取与 Snackbar 关联的 TextView,以便更改它在屏幕上显示的位置的重力,但仅限于某些情况(即我不想更改 XML 定义中的重力)。
我怎样才能阻止这种情况发生?