我是测试的初学者.我在android studio中为登录活动创建了一个简单的测试用例.但我得到了一个错误,我无法解决它.这是我的测试代码.帮助将非常感激.
package com.example.hassidiczaddic.testinglist;
import android.app.Application;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import android.test.ActivityInstrumentationTestCase2;
import android.test.ApplicationTestCase;
import android.test.suitebuilder.annotation.LargeTest;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.action.ViewActions.closeSoftKeyboard;
import static android.support.test.espresso.action.ViewActions.typeText;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class ApplicationTest {
public static final String STRING_TO_BE_TYPED = "Wolfmatrix";
@Rule
public ActivityTestRule<MainActivity> mActivityRule = new ActivityTestRule<>(MainActivity.class);
@Test
public void LoginActivity() {
onView(withId(R.id.etFName))
.perform(typeText(STRING_TO_BE_TYPED), closeSoftKeyboard());
onView(withId(R.id.etLName))
.perform(typeText(STRING_TO_BE_TYPED), closeSoftKeyboard());
onView(withId(R.id.btnSubmit))
.perform(click());
onView(withId(R.id.tvView))
.check(matches(withText(STRING_TO_BE_TYPED))); …Run Code Online (Sandbox Code Playgroud) 我在谷歌阅读和阅读博客但仍无法得出结论,我们可以通过自定义应用程序上传iBooks PDF文件吗?有人说"不,目前无法获取此信息"
我有像Gmail这样的应用程序.现在我想发送可能是图像或PDF文件的邮件.我可以轻松地从手机上附加图像文件,但不能从我的iBooks中删除PDF.
是否必须通过iClouds上传PDF?希望我能从这里得出关于这个问题的结论.
假设我有一个 json 字符串,其中有一个名为 data 的 json 数组。该数组保存用户个人资料数据的 json 对象,例如姓名、年龄、性别等。
现在想要按顺序解析该 json 对象,例如,如果该对象是
{
"name": "sample name",
"age": "30",
"gender": "male"
}
Run Code Online (Sandbox Code Playgroud)
我想像name,age,genderios 一样按顺序解析列表,当我将 json 对象转换为字典时,顺序发生了变化,我知道字典没有排序,那么实现此目的的替代方法是什么?
它是第三方 api,所以我没有任何帮助,我们已经在 android 中使用链接哈希映射完成了它,但实际上陷入了 swift ,我想做的最后一件事就是用正则表达式进行解析。
我按以下方式解析 json:
var rootData = try JSONSerialization.jsonObject(with: data!) as! [String:Any]
if let val = fromList["data"] {
let dataNode = val as! [[String:Any]]
for row in dataNode {
for (key,keyVal) in row {
//here the key is not in order.because when we cast it as dictionary the order …Run Code Online (Sandbox Code Playgroud) 我是Android Butterknife的新手,想要改变浮动Button的背景颜色.我无法做到这一点.我怎么能实现这一点.提前谢谢.当我使用时,应用程序崩溃了.
floatingActionButton.setBackgroundTintList(ColorStateList.valueOf(Color
.parseColor("#33691E")));
Run Code Online (Sandbox Code Playgroud)
如果我不整合Butterknife,这很好.这是我的浮动按钮
<android.support.design.widget.FloatingActionButton
android:layout_width="wrap_content"
android:id="@+id/fab1"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
app:rippleColor="@android:color/white"
android:layout_margin="16dp"
android:src="@drawable/circle"
android:onClick="newForm"
app:layout_anchorGravity="bottom|right|end" />
Run Code Online (Sandbox Code Playgroud)
并在MainActivity中
public class MainActivity extends AppCompatActivity implements
SearchView.OnQueryTextListener {
@BindView(R.id.fab1)
FloatingActionButton floatingActionButton;
@BindColor(R.color.colorFolatingButton)
int Floating_Button_Color;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
setSupportActionBar(toolbar);
floatingActionButton.setBackgroundColor(Floating_Button_Color);
}
@OnClick(R.id.fab1)
public void newForm (View view){
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
builder.setTitle("Confirm");
builder.setMessage("Are you sure?");
builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Intent intent = new Intent(getApplicationContext(),BuilderPage.class);
startActivity(intent);
}
});
builder.setNegativeButton("No", new …Run Code Online (Sandbox Code Playgroud) 这是我的代码
func enteredByStr(S:String) -> String? {
var healthactionplan : MyHealthActionPlanCondition
if healthactionplan.addedBy != nil {
healthactionplan.addedBy = "System"
} else {
healthactionplan.addedBy = "Member"
}
}
Run Code Online (Sandbox Code Playgroud)