文本输入与输出
来源:互联网 发布:剑三抓马坐标数据下载 编辑:程序博客网 时间:2024/05/01 14:29
文本输入findViewById,监听按钮button.setOnClickListener,文本输出setText。
package com.example.gogear777.myapplication;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.view.View.OnClickListener;
public class MyActivity extends Activity {
private EditText user = null;
private TextView result = null;
private Button button = null;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//载入main.xml Layout,此时myTextView:text为hello
setContentView(R.layout.activity_my);
user = (EditText) findViewById(R.id.user);
result = (TextView) findViewById(R.id.result);
button = (Button) findViewById(R.id.button);
button.setOnClickListener(new OnClickListener() {
public void onClick(View view) {
String name = user.getText().toString();
System.out.println(name);
result.setText(name);
}
});
}
}
0 0
- 文本输入与输出
- 文本输入与输出(1)
- 文本输入与输出(2)
- 15.2 文本输入与输出
- 文本的输入&输出
- Java中的流与文件:文本的输入与输出
- java基本输入输出编程:文本界面的输入与输出
- 输入与输出
- 输入与输出
- 流类库与输入/输出
- shell 输入与输出
- shell 输入与输出
- 文件输入与输出
- IO输入与输出
- IO输入与输出
- IO/输入与输出
- IO输入与输出
- IO输入与输出
- ecshop报错问题解决
- 2014新生暑假个人排位赛03
- 利用webservice查询ip的物理地址 java实现
- EL 表达式
- Android颜色(RGB)对照表
- 文本输入与输出
- hibernate抓取策略
- hdu4856(状态压缩)
- JNDI 是什么
- 抽象工厂模式
- MySQL存储引擎比较
- 找工作
- UVA 712 S-Trees
- Codeforces 50C Happy Farm 5 凸包