Chinaunix首页 | 论坛 | 博客
  • 博客访问: 574451
  • 博文数量: 192
  • 博客积分: 3780
  • 博客等级: 中校
  • 技术积分: 1487
  • 用 户 组: 普通用户
  • 注册时间: 2010-08-26 10:11
文章存档

2012年(6)

2011年(160)

2010年(26)

分类: 嵌入式

2011-04-14 17:30:03

android手机定位器经验谈一

    在本教程中,我们将创建一个叫做PhoneFinder的应用。本应用将演示如何发送和接收短信。当你的手机丢了或者被偷,你可以使用别人 的手机,接收你手机所处位置的GPS坐标,从而找到你的手机,这正是本应用的创意来源。 本应用需要一个Activity让用户输入密码,还需要一个IntentReceiver来过滤接收到的短信。

这里下载全部源码

    译者注:本文完全按照原文翻译,如果说明文字中的代码行号和实际显示的代码行号有出入,请按代码执行的功能理解密码输入如下所示,我们使用 一个简单的对话框来帮助用户输入密码。一旦密码被正确输入,我们将把密码的MD5置入应用包的SharedPreferences中。 Preferences是一个存储少量持久数据的好地方,包中的其他类也可以访问Preferences。之所以存储密码的MD5,是因为即使密码被读 取,它也不会泄露密码的明文,除非这密码本身非常弱。 上图所示的对话框对应的layout文件,main.xml如下所示:

 
android:orientation="vertical" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" TextView 
android:layout_width="fill_parent" 
android:layout_height="wrap_content"

    android:text="@string/password_label" 
/> 
android:maxLines="1" 
android:layout_marginTop="2dip"

    android:layout_width="wrap_content" 
android:ems="25"

    android:layout_height="wrap_content" 
android:autoText="true"

    android:scrollHorizontally="true" 
android:password="true" />

    lt;TextView 
android:layout_width="fill_parent"

    android:layout_height="wrap_content"

    android:text="@string/password_confirm_label" 
/> 
android:maxLines="1" 
android:layout_marginTop="2dip"

    android:layout_width="wrap_content" 
android:ems="25"

    android:layout_height="wrap_content" 
android:autoText="true"

    android:scrollHorizontally="true" 
android:password="true" />

阅读(483) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~