Android移动终端设计实验三+Intent与Activity实验

Android移动终端设计实验三+Intent与Activity实验

实验3:Intent与Activity实验


一、     实验目的

本次实验的目的是了解Intent的Action、Catalog、Data等属性的用法,掌握Intent的启动机制以及利用Intent意图在应用程序Activity间启动、停止和传输数据。

二、     实验环境

Windows7  Eclipse MARS.2  AVD虚拟机

三、实验内容及结果

题目1

在实验1建立的登录界面基础上,实现:点击登录按钮后,显示登录成功界面;

题目2

在实验1建立的登录界面基础上,

实现:点击登录按钮后,显示登录成功界面,并显示登录用户名,即:“欢迎XXX使用本系统字样”;

 

1.       无参数传递

代码实现:

 

Activity_main.xml

<LinearLayoutxmlns:android=

"http://schemas.android.com/apk/res/android"

xmlns:tools="http://schemas.android.com/tools"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:orientation="vertical">

<TextView

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:text="欢迎使用登录系统    -by庞振男"

></TextView>

 

  <LinearLayout

  android:layout_width="match_parent"

  android:layout_height="wrap_content"

  android:orientation="horizontal"

  >

<TextView

android:id="@+id/user"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="用户名:"/>

<EditText

android:id="@+id/username"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:hint="input username"

 

></EditText>

     </LinearLayout>

     <LinearLayout

  android:layout_width="match_parent"

  android:layout_height="wrap_content"

  android:orientation="horizontal"

  >

<TextView

android:id="@+id/pass"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="密码:"/>

<EditText

android:id="@+id/password"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:hint="input password"

android:inputType="textPassword"

></EditText>

  </LinearLayout>

 

  <LinearLayout

  android:layout_width="match_parent"

  android:layout_height="wrap_content"

  android:orientation="horizontal"

  >

     <Button

     android:id="@+id/login"

     android:layout_width="wrap_content"

  android:layout_height="match_parent"

  android:text="登录"

     ></Button>

     <Button

     android:id="@+id/cancel"

     android:layout_width="wrap_content"

  android:layout_height="match_parent"

  android:text="取消"

     ></Button>

     </LinearLayout>

 

  <TextView

  android:id="@+id/show"

  android:layout_width="wrap_content"

  android:layout_height="wrap_content"

  android:text="tips:"/>

</LinearLayout>

 

MainActivity.java

 

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值