文档编制序号:[KKIDT-LLE0828-LLETD298-POI08]
文档编制序号:[KKIDT-LLE0828-LLETD298-POI08]
安卓开发实验报告
安卓开发实验报告
目录
页面跳转
长按图标抖动以及显示删除
页面跳转
功能:通过点击button实现2个activity之间的跳转。
1.设置监听器监听点击button
2.使用intent传输数据
完整代码
class UI_Test extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
(savedInstanceState);
setContentView Button bt = (Button)findViewById (new OnClickListener());
}
class OnClickListener implements {
public void onClick(View v){
EditText name = (EditText)findViewById EditText password = (EditText)findViewById Bundle data=new Bundle();
("name", ().toString());
("password", ().toString());
Intent intent = new Intent,;
(data);
startActivity(intent);
}
}
class UI_Result extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
(savedInstanceState);
setContentView TextView name = (TextView)findViewById TextView password = (TextView)findViewById Intent intent=getIntent();
Bundle result = ();
("您的用户名为: "+("name"));
("您的密码为: "+("password"));
}
}
version="" encoding="utf-8">
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="请输入您的信息"
android:textSize="20sp"
/>
android:id="@+id/tableRow1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="用户名"
android:textSize="16sp"
/>
android:id="@+id/name"
android:layout_width="fill_parent"
an