AndroidGPS定位详解 (4)

来源:互联网 发布:matlab矩阵赋值 编辑:程序博客网 时间:2024/06/07 09:12
为了便于理解,接下来模拟一个案例,如何在程序代码中使用GPS获取位置信息。
第一步:新建一个Android工程项目,命名为mygps,目录结构如下


第二步:修改main.xml布局文件,修改内容如下:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    androidrientation
="vertical"
    android:layout_width
="fill_parent"
    android:layout_height
="fill_parent">
    <EditText android:layout_width="fill_parent"
        android:layout_height
="wrap_content"
        android:cursorVisible
="false"
        android:editable
="false"
        android:id
="@+id/editText"/>
</LinearLayout>