package android.m9;
 
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
 
public class helloWorld extends Activity {
 
private TextView logo;
private EditText et;
private Button reset, submit;
private EditText result;
private String name;
private String lastName = "";
private int rp;
 
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// /////////////////////////////////////////////
// logo set
logo = (TextView) findViewById(R.id.TextView_1);
logo.setText(R.string.logo);
// ////////////////////////////////////////////
// EditText set
et = (EditText) findViewById(R.id.EditText_1);
et.setText(R.string.inputTip);
// ////////////////////////////////////////////
// Button set:reset
reset = (Button) findViewById(R.id.Button_1);
reset.setText(R.string.reset);
reset.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
et.setText(R.string.inputTip);
result.setText("");
}
});
//Button set:reset
submit = (Button) findViewById(R.id.Burron_2);
submit.setText(R.string.submit);
submit.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
name = et.getText().toString();
if (!lastName.equals(name)) {
rp = (int) (Math.random() * 100);
result.setText("测试者姓名:" + name + "\n\n" + "人品得分:" + rp);
lastName = name;http://www.huiyi8.com/webyuanma/
result.setText("请更换测试者!\n\n测试者姓名:" + name + "\n\n"
+ "人品得分:" + rp);
}
 
}
});
// ////////////////////////////////////////////
// TextView set
result = (EditText) findViewById(R.id.EditText_2);
result.setEnabled(false);
result.setTextColor(android.graphics.Color.BLUE);
}
 
@Override
public boolean onCreateOptionsMenu(Menu menu) {
menu.add(0, 1, 1, R.string.exit);
return super.onCreateOptionsMenu(menu);
}
 
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == 1) {
finish();
}
return super.onOptionsItemSelected(item);
}
 
}

最新文章

  1. [Cordova] Plugin里使用Android Library
  2. git 教程(3)--时光机穿梭
  3. AIM Tech Round 3 (Div. 2) A B C D
  4. 配置Tomcat 中文字符集问题
  5. GLSL实现Interactive Fluid 流体【转】
  6. UILabel 自适应大小
  7. php中var_export与var_dump的区别分析
  8. Elasticsearch学习1--head插件安装
  9. Spring Boot集成Jasypt安全框架
  10. 武汉科技大学ACM:1007: 陶陶摘苹果
  11. 【剑指offer】面试题28:字符串的排列
  12. python 性能优化
  13. Entity Framework基金会
  14. 算法模板——Dinic网络最大流 2
  15. 小强的Hadoop学习之路
  16. SQL模板资源管理器,你用了吗?
  17. PyCharm2019 激活码
  18. Mysql生产指定时间段随机日期函数
  19. 五、core开发
  20. node_01_自定义模块(先创建package.json)

热门文章

  1. Attempt to invoke virtual method 'void android.app.ActionBar.setTitle的解决方法
  2. android clipRect Op.xxx各个参数理解
  3. vue Syntax Error: Unexpected token {
  4. 手动安装pip
  5. vscode格式化代码无效--可能的解决方法
  6. 使用 sftp 向linux服务器传输文件
  7. 广告制胜无它,顺应人性尔——leo鉴书63
  8. mysql 查看当前连接数
  9. hdu3251 最小割
  10. 牛顿迭代法(Newton's Method)