我试图用Espresso来测试我的用户界面.当我登录我的应用程序时,我会调用Parse API(网络呼叫)来验证用户名和密码.如果一切顺利,用户将被定向到新活动.我想测试一下,但我似乎无法使用空闲资源的东西.
码:
public class ApplicationTest extends ActivityInstrumentationTestCase2<LoginActivity> {
private CountingIdlingResource fooServerIdlingResource;
public ApplicationTest() {
super(LoginActivity.class);
}
@Before
public void setUp() throws Exception {
super.setUp();
injectInstrumentation(InstrumentationRegistry.getInstrumentation());
getActivity();
CountingIdlingResource countingResource = new CountingIdlingResource("FooServerCalls");
this.fooServerIdlingResource = countingResource;
Espresso.registerIdlingResources(countingResource);
}
public void testChangeText_sameActivity() {
// Type text and then press the button.
onView(withId(R.id.username))
.perform(typeText("s@s.nl"), closeSoftKeyboard());
onView(withId(R.id.password))
.perform(typeText("s"), closeSoftKeyboard());
if(performClick())
onView(withId(R.id.main_relative_layout))
.check(matches(isDisplayed()));
// Check that the text was changed.
}
public boolean performClick(){
fooServerIdlingResource.increment();
try {
onView(withId(R.id.login)).perform(click());
return true;
} finally {
fooServerIdlingResource.decrement();
} …Run Code Online (Sandbox Code Playgroud) 我正在为我的应用程序执行GCM到FCM Migration.但是当我在设备上测试我的最终代码时,我在Logcat中遇到以下错误,并且对Firebase的调用失败.
E/FirebaseInstanceId: Token retrieval failed: RST
Run Code Online (Sandbox Code Playgroud)
Firebase文档中没有"RST"含义等信息.
谁能帮助我?
编辑
android firebase google-cloud-messaging firebase-cloud-messaging
我目前正在 AppCompatActivity 中使用 FlutterFragment。
另外,我使用预热的 flutter 引擎和 FlutterPlugin 在需要时提供往返于本机/flutter 的 methodChannel 。
我目前的情况是,当我的 FlutterFragment 加载时,我想通过插件启动一个特定的方法来颤动。
我现在知道onAttachedToEngine当插件附加到引擎时,它会在 FlutterPlugin 中被调用。
但现在FlutterFragment需要在启动时调用该插件。
在 FlutterFragment 调用插件调用之前,如何确保插件已附加到引擎。另一方面,在插件调用片段上的任何内容之前,如何确保 FlutterFragment 已附加并准备就绪。
我唯一看到的就是ActivityAware界面。我想过从activity中的fragmentManager获取fragment,但是由于某种原因这些接口方法从未被调用。
旁注:我无法轻松地将 AppCompatActivity 更改为 FlutterFragmentActivity,因此如果不需要,那么这就是我的偏好。
我在显示图像时遇到问题.
我有一个想要全屏显示的图像.所以我有这个带有match_parent和20dp填充的Imageview.
它看起来不错但是当我对它应用旋转时,似乎视图的边界不会改变,并且图像可能会被截断出屏幕!完全不希望发生这种情况!如何重新缩放图像,以便在旋转90度时图像也适合ImageView.
这是我的XML WITH旋转.
编辑:
关于这一点有很多问题.但他们都谈论将重点放在一个领域.这是我的问题:
我有一个输入类型字段.当用户点击它时,它将打开我的自定义mobiscroll功能.在某些情况下,如Android 2.*或Windows平板电脑,它也显示虚拟键盘!如何编写虚拟键盘永远不会出现的情况!
谁能帮我 :)
android ×4
bounds ×1
firebase ×1
flutter ×1
imageview ×1
javascript ×1
jquery ×1
keyboard ×1
mobiscroll ×1
networking ×1
rotation ×1
view ×1
virtual ×1