Android 使用Instrumentation進行自動化測試
阿新 • • 發佈:2019-01-02
mButton.setOnClickListener(new OnClickListener(){
public void onClick(View v){
String msg = mEditText.getText().toString();
if (msg.equals("1")) {
Toast.makeText(getApplicationContext(), "hello_1", Toast.LENGTH_LONG).show();
} else if(msg.equals("2")){
Toast.makeText(getApplicationContext(), "hello_2", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(getApplicationContext(), "hello_nothing", Toast.LENGTH_SHORT).show();
}
}
});
public void onClick(View v){
String msg = mEditText.getText().toString();
if (msg.equals("1")) {
Toast.makeText(getApplicationContext(), "hello_1", Toast.LENGTH_LONG).show();
} else if(msg.equals("2")){
Toast.makeText(getApplicationContext(), "hello_2", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(getApplicationContext(), "hello_nothing", Toast.LENGTH_SHORT).show();
}
}
});