Browse Source

增加android项目

liuyuqi-dellpc 4 years ago
parent
commit
ac1ddc9f2e
40 changed files with 2278 additions and 0 deletions
  1. 9 0
      android/.classpath
  2. 3 0
      android/.gitignore
  3. 33 0
      android/.project
  4. 81 0
      android/AndroidManifest.xml
  5. BIN
      android/ic_launcher-web.png
  6. BIN
      android/libs/android-support-v4.jar
  7. BIN
      android/libs/armeabi/libapp_BaiduMapApplib_v2_0_0.so
  8. BIN
      android/libs/armeabi/liblocSDK3.so
  9. BIN
      android/libs/armeabi/libvi_voslib.so
  10. BIN
      android/libs/baidumapapi_v2_0_0.jar
  11. BIN
      android/libs/locSDK_3.3.jar
  12. 20 0
      android/proguard-project.txt
  13. 14 0
      android/project.properties
  14. BIN
      android/res/drawable-hdpi/current_position.png
  15. BIN
      android/res/drawable-hdpi/ic_launcher.png
  16. BIN
      android/res/drawable-hdpi/icon_marka.png
  17. BIN
      android/res/drawable-hdpi/marker_red_1.png
  18. BIN
      android/res/drawable-hdpi/pop.9.png
  19. BIN
      android/res/drawable-mdpi/ic_launcher.png
  20. BIN
      android/res/drawable-xhdpi/ic_launcher.png
  21. BIN
      android/res/drawable-xxhdpi/ic_launcher.png
  22. 186 0
      android/res/layout/activity_main.xml
  23. 113 0
      android/res/layout/contentitem.xml
  24. 28 0
      android/res/layout/list_item_footer.xml
  25. 13 0
      android/res/layout/map.xml
  26. 25 0
      android/res/layout/marker_pop.xml
  27. 14 0
      android/res/layout/progress.xml
  28. 8 0
      android/res/menu/main.xml
  29. 50 0
      android/res/values/arrays.xml
  30. 22 0
      android/res/values/colors.xml
  31. 7 0
      android/res/values/dimens.xml
  32. 24 0
      android/res/values/strings.xml
  33. 20 0
      android/res/values/styles.xml
  34. 86 0
      android/src/com/baidu/lbs/duanzu/ContentModel.java
  35. 194 0
      android/src/com/baidu/lbs/duanzu/DemoApplication.java
  36. 234 0
      android/src/com/baidu/lbs/duanzu/LBSListActivity.java
  37. 509 0
      android/src/com/baidu/lbs/duanzu/MainActivity.java
  38. 173 0
      android/src/com/baidu/lbs/duanzu/bdapi/LBSCloudSearch.java
  39. 86 0
      android/src/com/baidu/lbs/duanzu/bdapi/LBSLocation.java
  40. 326 0
      android/src/com/baidu/lbs/duanzu/bdapi/LBSMapActivity.java

+ 9 - 0
android/.classpath

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="src" path="gen"/>
+	<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
+	<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
+	<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
+	<classpathentry kind="output" path="bin/classes"/>
+</classpath>

+ 3 - 0
android/.gitignore

@@ -0,0 +1,3 @@
+/gen
+/bin
+/.settings

+ 33 - 0
android/.project

@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>LBSDuanZu</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>com.android.ide.eclipse.adt.ApkBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

+ 81 - 0
android/AndroidManifest.xml

@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.baidu.lbs.duanzu"
+    android:versionCode="1"
+    android:versionName="1.0" >
+
+    <uses-sdk
+        android:minSdkVersion="8"
+        android:targetSdkVersion="9" />
+
+    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" >
+    </uses-permission>
+    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" >
+    </uses-permission>
+    <uses-permission android:name="android.permission.INTERNET" >
+    </uses-permission>
+    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" >
+    </uses-permission>
+    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" >
+    </uses-permission>
+    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" >
+    </uses-permission>
+    <uses-permission android:name="android.permission.READ_PHONE_STATE" >
+    </uses-permission>
+    <uses-permission android:name="android.permission.CALL_PHONE" >
+    </uses-permission>
+
+    <permission android:name="android.permission.BAIDU_LOCATION_SERVICE" >
+    </permission>
+
+    <uses-permission android:name="android.permission.BAIDU_LOCATION_SERVICE" >
+    </uses-permission>
+    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" >
+    </uses-permission>
+    <uses-permission android:name="android.permission.ACCES_MOCK_LOCATION" >
+    </uses-permission>
+    <uses-permission android:name="android.permission.ACCESS_GPS" />
+
+    <supports-screens
+        android:anyDensity="true"
+        android:largeScreens="true"
+        android:normalScreens="false"
+        android:resizeable="true"
+        android:smallScreens="true" />
+
+    <application
+        android:name="com.baidu.lbs.duanzu.DemoApplication"
+        android:allowBackup="true"
+        android:icon="@drawable/ic_launcher"
+        android:label="@string/app_name"
+        android:theme="@style/AppTheme" >
+        <activity
+            android:name="com.baidu.lbs.duanzu.MainActivity"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:theme="@android:style/Theme.NoTitleBar" >
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+        <activity
+            android:name="com.baidu.lbs.duanzu.bdapi.LBSMapActivity"
+            android:screenOrientation="portrait"
+            android:theme="@android:style/Theme.NoTitleBar" >
+        </activity>
+        <activity
+            android:name="com.baidu.lbs.duanzu.LBSListActivity"
+            android:screenOrientation="portrait"
+            android:theme="@android:style/Theme.NoTitleBar" >
+        </activity>
+
+        <service
+            android:name="com.baidu.location.f"
+            android:enabled="true"
+            android:process=":remote" >
+        </service>
+    </application>
+
+</manifest>

BIN
android/ic_launcher-web.png


BIN
android/libs/android-support-v4.jar


BIN
android/libs/armeabi/libapp_BaiduMapApplib_v2_0_0.so


BIN
android/libs/armeabi/liblocSDK3.so


BIN
android/libs/armeabi/libvi_voslib.so


BIN
android/libs/baidumapapi_v2_0_0.jar


BIN
android/libs/locSDK_3.3.jar


+ 20 - 0
android/proguard-project.txt

@@ -0,0 +1,20 @@
+# To enable ProGuard in your project, edit project.properties
+# to define the proguard.config property as described in that file.
+#
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in ${sdk.dir}/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the ProGuard
+# include property in project.properties.
+#
+# For more details, see
+#   http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+#   public *;
+#}

+ 14 - 0
android/project.properties

@@ -0,0 +1,14 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system edit
+# "ant.properties", and override values to adapt the script to your
+# project structure.
+#
+# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
+#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
+
+# Project target.
+target=android-21

BIN
android/res/drawable-hdpi/current_position.png


BIN
android/res/drawable-hdpi/ic_launcher.png


BIN
android/res/drawable-hdpi/icon_marka.png


BIN
android/res/drawable-hdpi/marker_red_1.png


BIN
android/res/drawable-hdpi/pop.9.png


BIN
android/res/drawable-mdpi/ic_launcher.png


BIN
android/res/drawable-xhdpi/ic_launcher.png


BIN
android/res/drawable-xxhdpi/ic_launcher.png


+ 186 - 0
android/res/layout/activity_main.xml

@@ -0,0 +1,186 @@
+<!-- 程序的主界面 -->
+<RelativeLayout xmlns:tools="http://schemas.android.com/tools"
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+    tools:context=".MainActivity" >
+
+    <RelativeLayout
+        android:id="@+id/title"
+        android:layout_width="fill_parent"
+        android:layout_height="44dp" >
+
+        <TextView
+            android:id="@+id/text_pop"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_alignParentLeft="false"
+            android:layout_centerHorizontal="true"
+            android:layout_centerVertical="true"
+            android:layout_marginLeft="60dp"
+            android:text="@string/title"
+            android:textAppearance="?android:attr/textAppearanceLarge" />
+
+        <ToggleButton
+            android:id="@+id/toggleButton1"
+            android:layout_width="70dp"
+            android:layout_height="fill_parent"
+            android:layout_alignBottom="@+id/text_pop"
+            android:layout_marginLeft="12dp"
+            android:layout_toRightOf="@+id/text_pop"
+            android:background="@color/contents_text"
+            android:gravity="left|center|bottom"
+            android:text="//"
+            android:textColor="@color/white"
+            android:textOff="筛选"
+            android:textOn="附近"
+            android:textSize="18dp" />
+
+        <TextView
+            android:id="@+id/toggle_text1"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="/附近"
+            android:layout_toRightOf="@+id/text_pop"
+            android:layout_alignBottom="@+id/text_pop"
+            android:layout_marginLeft="48dp"
+            android:textAppearance="?android:attr/textAppearanceSmall" />
+        
+         <TextView
+             android:id="@+id/toggle_text2"
+             android:layout_width="wrap_content"
+             android:layout_height="wrap_content"
+             android:layout_alignBottom="@+id/text_pop"
+             android:layout_marginLeft="48dp"
+             android:layout_toRightOf="@+id/text_pop"
+             android:text="/筛选"
+             android:textAppearance="?android:attr/textAppearanceSmall"
+             android:visibility="invisible" />
+
+    </RelativeLayout>
+
+    <RelativeLayout
+        android:id="@+id/filter"
+        android:layout_width="wrap_content"
+        android:layout_height="40dp"
+        android:layout_below="@+id/title" >
+
+        <HorizontalScrollView
+            android:id="@+id/filter1"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content" >
+
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:orientation="horizontal" >
+
+                <Spinner
+                    android:id="@+id/spinner1"
+                    android:layout_width="wrap_content"
+                    android:layout_height="40dp" />
+
+                <Spinner
+                    android:id="@+id/spinner2"
+                    android:layout_width="wrap_content"
+                    android:layout_height="40dp" />
+
+                <Spinner
+                    android:id="@+id/spinner3"
+                    android:layout_width="wrap_content"
+                    android:layout_height="40dp" />
+            </LinearLayout>
+        </HorizontalScrollView>
+
+        <RadioGroup
+            android:id="@+id/filter2"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:orientation="horizontal"
+            android:visibility="invisible" >
+
+            <RadioButton
+                android:id="@+id/radio0"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:checked="true"
+                android:text="@string/nearby_1000" />
+
+            <RadioButton
+                android:id="@+id/radio1"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="@string/nearby_3000" />
+
+            <RadioButton
+                android:id="@+id/radio2"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:checked="true"
+                android:text="@string/nearby_5000" />
+
+        </RadioGroup>
+    </RelativeLayout>
+
+    <RelativeLayout
+        android:id="@+id/content"
+        android:layout_width="fill_parent"
+        android:layout_height="fill_parent"
+        android:layout_alignParentBottom="true"
+        android:layout_below="@+id/filter" >
+
+        <TabHost
+            android:id="@android:id/tabhost"
+            android:layout_width="fill_parent"
+            android:layout_height="fill_parent"
+            android:layout_alignParentBottom="true"
+            android:layout_alignParentLeft="true" >
+
+            <RelativeLayout
+                android:layout_width="fill_parent"
+                android:layout_height="fill_parent"
+                android:orientation="vertical" >
+
+                <FrameLayout
+                    android:id="@android:id/tabcontent"
+                    android:layout_width="fill_parent"
+                    android:layout_height="fill_parent"
+                    android:layout_above="@android:id/tabs" >
+                    <ListView
+                        android:id="@+id/listView1"
+                        android:layout_width="match_parent"
+                        android:layout_height="match_parent" >
+                    </ListView>
+
+                </FrameLayout>
+
+                <TabWidget
+                    android:id="@android:id/tabs"
+                    android:layout_width="fill_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_alignParentBottom="true"
+                    android:layout_centerInParent="true" >
+                </TabWidget>
+            </RelativeLayout>
+        </TabHost>
+
+    </RelativeLayout>
+
+    <RelativeLayout
+        android:id="@+id/progress"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:background="@color/transparent"
+        android:clickable="false"
+        android:visibility="invisible" >
+
+        <ProgressBar
+            android:id="@+id/progressBar1"
+            style="?android:attr/progressBarStyleLarge"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_centerInParent="true" />
+
+    </RelativeLayout>
+
+</RelativeLayout>

+ 113 - 0
android/res/layout/contentitem.xml

@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 列表item view -->
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="fill_parent"
+    android:layout_height="wrap_content"
+    android:background="#FFFFFF"
+    android:orientation="horizontal" >
+
+    <ImageView
+        android:id="@+id/icon"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_centerVertical="true"
+        android:layout_margin="10dp"
+        android:src="@drawable/ic_launcher" />
+
+    <LinearLayout
+        android:id="@+id/linearlayout1"
+        android:layout_width="wrap_content"
+        android:layout_height="fill_parent"
+        android:layout_toRightOf="@+id/icon"
+        android:layout_toLeftOf="@+id/linearlayout2"
+        android:orientation="vertical" >
+
+        <TextView
+            android:id="@+id/name"
+            android:layout_width="fill_parent"
+            android:layout_height="wrap_content"
+            android:ellipsize="none"
+            android:gravity="center_vertical"
+            android:text="百度公寓地方送id金佛Iio大家佛就是都放假哦的积分愤怒的送in罚款决定能否拿到家咖啡"
+            android:textColor="@color/contents_text"
+            android:textSize="18dip" />
+
+        <TextView
+            android:id="@+id/addr"
+            android:layout_width="fill_parent"
+            android:layout_height="wrap_content"
+            android:ellipsize="none"
+            android:gravity="center_vertical"
+            android:text="上地7街丰富的送if接哦id积极的佛I惊悚的"
+            android:textColor="@color/contents_text"
+            android:textSize="14dp"
+            android:visibility="visible" />
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content" >
+
+            <TextView
+                android:id="@+id/toggle_text1"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="出租类型:"
+                android:textAppearance="?android:attr/textAppearanceSmall"
+                android:textColor="@color/contents_text"
+                android:textSize="14dp" />
+
+            <TextView
+                android:id="@+id/leaseType"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:textAppearance="?android:attr/textAppearanceSmall"
+                android:textColor="@color/contents_text"
+                android:textSize="14dp" />
+
+        </LinearLayout>
+
+        <TextView
+            android:id="@+id/distance"
+            android:layout_width="fill_parent"
+            android:layout_height="wrap_content"
+            android:gravity="center_vertical"
+            android:text="距离300米"
+            android:textColor="@color/contents_text"
+            android:textSize="14dp" />
+
+    </LinearLayout>
+
+    <LinearLayout
+        android:id="@+id/linearlayout2"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignParentRight="true"
+        android:layout_centerVertical="true"
+        android:orientation="vertical"
+        android:paddingLeft="10dp"
+        android:paddingRight="10dp" >
+
+        <TextView
+            android:id="@+id/price"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center"
+            android:enabled="true"
+            android:maxLines="2"
+            android:text="300"
+            android:textColor="@color/red"
+            android:textSize="22dp" />
+
+        <TextView
+            android:id="@+id/TextView01"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center"
+            android:enabled="true"
+            android:maxLines="2"
+            android:text="元/晚"
+            android:textColor="@color/red"
+            android:textSize="22dp" />
+    </LinearLayout>
+
+</RelativeLayout>

+ 28 - 0
android/res/layout/list_item_footer.xml

@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 列表底部的footer view -->
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="fill_parent"
+    android:layout_height="50dp"
+    android:background="#FFFFFF"
+    android:clickable="true" >
+
+	<TextView
+	    android:id="@+id/main_text"
+	    android:layout_width="wrap_content"
+	    android:layout_height="wrap_content"
+	    android:layout_centerHorizontal="true"
+	    android:layout_centerVertical="true"
+	    android:text="点击查看更多"
+	    android:textAppearance="?android:attr/textAppearanceMedium"
+	    android:textColor="@color/contents_text" />
+
+	<ProgressBar
+	    android:id="@+id/progressBar"
+	    android:layout_width="wrap_content"
+	    android:layout_height="wrap_content"
+	    android:layout_alignParentLeft="true"
+	    android:layout_marginLeft="20dp"
+	    android:visibility="invisible" 
+	    style="@android:style/Widget.ProgressBar.Inverse"/>
+
+</RelativeLayout>

+ 13 - 0
android/res/layout/map.xml

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 百度地图View -->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent" >
+  
+     <com.baidu.mapapi.map.MapView android:id="@+id/bmapView"
+	android:layout_width="fill_parent" android:layout_height="fill_parent" 
+	android:clickable="true"     
+/>
+
+
+</LinearLayout>

+ 25 - 0
android/res/layout/marker_pop.xml

@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 点击地图标记后,弹出的view -->
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/marker_pop"
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"
+    android:layout_marginLeft="12dp"
+    android:layout_marginTop="12dp"
+    android:background="@drawable/pop"
+    android:clickable="true"
+    android:gravity="center"
+    android:padding="10dp"
+    android:paddingBottom="20dp" >
+
+    <TextView
+        android:id="@+id/text_pop"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_centerHorizontal="true"
+        android:paddingBottom="10dp"
+        android:text="@string/pop"
+        android:textAppearance="?android:attr/textAppearanceSmall"
+        android:textColor="@color/contents_text" />
+
+</RelativeLayout>

+ 14 - 0
android/res/layout/progress.xml

@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 网络请求是的等待进度 -->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical" >
+
+    <ProgressBar
+        android:id="@+id/progressBar1"
+        style="?android:attr/progressBarStyleLarge"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content" />
+
+</LinearLayout>

+ 8 - 0
android/res/menu/main.xml

@@ -0,0 +1,8 @@
+<menu xmlns:android="http://schemas.android.com/apk/res/android" >
+
+    <item
+        android:id="@+id/action_settings"
+        android:orderInCategory="100"
+        android:title="@string/action_settings"/>
+
+</menu>

+ 50 - 0
android/res/values/arrays.xml

@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <string-array name="region">
+        <item>全北京</item>
+        <item>朝阳</item>
+        <item>海淀</item>
+        <item>东城</item>
+        <item>西城</item>
+        <item>崇文</item>
+        <item>宣武</item>
+        <item>丰台</item>
+        <item>通州</item>
+        <item>石景山</item>
+        <item>房山</item>
+        <item>昌平</item>
+        <item>大兴</item>
+        <item>顺义</item>
+        <item>密云</item>
+        <item>怀柔</item>
+        <item>延庆</item>
+        <item>平谷</item>
+        <item>门头沟</item>
+    </string-array>
+    
+    <string-array name="price">
+        <item>价格</item>
+        <item>50元以下</item>
+        <item>50-100元</item>
+        <item>100-150元</item>
+        <item>150-200元</item>
+        <item>200-250元</item>
+        <item>250-300元</item>
+        <item>300元以上</item>
+    </string-array>
+    
+    <string-array name="category">
+        <item>类型</item>
+        <item>整租</item>
+        <item>单间出租</item>
+        <item>单间出租(隔断)</item>
+       	<item>床位出租</item>	
+    </string-array>
+    
+    <string-array name="nearby">
+        <item>附近</item>
+        <item>1000米</item>
+        <item>3000米</item>
+        <item>5000米</item>
+    </string-array>
+</resources>

+ 22 - 0
android/res/values/colors.xml

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (C) 2008 ZXing authors
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<resources>
+  <color name="contents_text">#ff000000</color>
+  <color name="white">#ffffffff</color>
+  <color name="red">#ffff0000</color>
+  <color name="transparent">#99000000</color>
+</resources>

+ 7 - 0
android/res/values/dimens.xml

@@ -0,0 +1,7 @@
+<resources>
+
+    <!-- Default screen margins, per the Android Design guidelines. -->
+    <dimen name="activity_horizontal_margin">16dp</dimen>
+    <dimen name="activity_vertical_margin">16dp</dimen>
+
+</resources>

+ 24 - 0
android/res/values/strings.xml

@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+    <string name="app_name">LBS云示例</string>
+    <string name="action_settings">Settings</string>
+    <string name="hello_world">Hello world!</string>
+    
+    <string name="title">LBS云示例</string>
+    <string name="city">北京</string>
+
+    <string name="tab_1_text">列表</string>
+    <string name="tab_2_text">地图模式</string>
+    
+    <string name="exit_confirm">确定退出</string>
+    <string name="button_ok">确定</string>
+    <string name="button_cancel">取消</string>
+    
+    <string name="empty_msg">抱歉!没有找到您想要的短租信息,请重新查询</string>
+    
+     <string name="nearby_1000">1000米</string>
+     <string name="nearby_3000">3000米</string>
+     <string name="nearby_5000">5000米</string>
+     <string name="pop">今天是风蓝,明天是雨蓝</string>
+</resources>

+ 20 - 0
android/res/values/styles.xml

@@ -0,0 +1,20 @@
+<resources>
+
+    <!--
+        Base application theme, dependent on API level. This theme is replaced
+        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
+    -->
+    <style name="AppBaseTheme" parent="android:Theme.Light">
+        <!--
+            Theme customizations available in newer API levels can go in
+            res/values-vXX/styles.xml, while customizations related to
+            backward-compatibility can go here.
+        -->
+    </style>
+
+    <!-- Application theme. -->
+    <style name="AppTheme" parent="AppBaseTheme">
+        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
+    </style>
+
+</resources>

+ 86 - 0
android/src/com/baidu/lbs/duanzu/ContentModel.java

@@ -0,0 +1,86 @@
+package com.baidu.lbs.duanzu;
+
+public class ContentModel {
+	private String addr;
+	private String name;
+	private String leaseType;
+	private String distance;
+	private String price;
+	private String imageurl;
+	private String webUrl;
+	private double latitude;
+	private double longitude;
+
+	public String getLeaseType() {
+		return leaseType;
+	}
+
+	public void setLeaseType(String leaseType) {
+		this.leaseType = leaseType;
+	}
+
+	public double getLatitude() {
+		return latitude;
+	}
+
+	public void setLatitude(Double latitude) {
+		this.latitude = latitude;
+	}
+
+	public double getLongitude() {
+		return longitude;
+	}
+
+	public void setLongitude(Double longitude) {
+		this.longitude = longitude;
+	}
+
+	public String getWebUrl() {
+		return webUrl;
+	}
+
+	public void setWebUrl(String webUrl) {
+		this.webUrl = webUrl;
+	}
+
+	public String getImageurl() {
+		return imageurl;
+	}
+
+	public void setImageurl(String imageurl) {
+		this.imageurl = imageurl;
+	}
+
+	public String getAddr() {
+		return addr;
+	}
+
+	public void setAddr(String addr) {
+		this.addr = addr;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public String getDistance() {
+		return distance;
+	}
+
+	public void setDistance(String distance) {
+		this.distance = distance;
+	}
+
+	public String getPrice() {
+		return price;
+	}
+
+	public void setPrice(String price) {
+		this.price = price;
+	}
+
+}

+ 194 - 0
android/src/com/baidu/lbs/duanzu/DemoApplication.java

@@ -0,0 +1,194 @@
+package com.baidu.lbs.duanzu;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.apache.http.HttpResponse;
+import org.apache.http.HttpStatus;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.impl.client.DefaultHttpClient;
+
+import android.app.Application;
+import android.content.Context;
+import android.net.ConnectivityManager;
+import android.net.NetworkInfo;
+import android.os.AsyncTask;
+import android.os.Handler;
+
+import com.baidu.lbs.duanzu.LBSListActivity.ContentAdapter;
+import com.baidu.lbs.duanzu.bdapi.LBSLocation;
+import com.baidu.lbs.duanzu.bdapi.LBSMapActivity;
+import com.baidu.location.BDLocation;
+
+/**
+ * 小猪短租应用类,用来共享定位结果,列表与地图检索结果数据
+ * 
+ * @author Lu.Jian
+ * 
+ */
+public class DemoApplication extends Application {
+
+	private static DemoApplication mInstance = null;
+
+	public static final String strKey = "63418012748CD126610D926A0546374D0BFC86D5";
+
+	// 定位结果
+	public BDLocation currlocation = null;
+
+	// 检索结果
+	private List<ContentModel> list = new ArrayList<ContentModel>();
+
+	// 用于更新检索结果后,刷新列表
+	private ContentAdapter adapter;
+
+	public static String networkType;
+
+	private Handler handler;
+	
+	//云检索参数
+	private HashMap<String, String> filterParams;	
+	
+	private LBSListActivity listActivity;
+	private LBSMapActivity mapActivity;
+
+	@Override
+	public void onCreate() {
+		super.onCreate();
+		mInstance = this;
+
+		networkType = setNetworkType();
+		// 启动定位
+		LBSLocation.getInstance(this).startLocation();
+	}
+
+	public static DemoApplication getInstance() {
+		return mInstance;
+	}
+
+	public LBSMapActivity getMapActivity() {
+		return mapActivity;
+	}
+
+	public void setMapActivity(LBSMapActivity mapActivity) {
+		this.mapActivity = mapActivity;
+	}
+
+	public LBSListActivity getListActivity() {
+		return listActivity;
+	}
+
+	public void setListActivity(LBSListActivity listActivity) {
+		this.listActivity = listActivity;
+	}
+
+	public ContentAdapter getAdapter() {
+		return adapter;
+	}
+
+	public void setAdapter(ContentAdapter adapter) {
+		this.adapter = adapter;
+	}
+
+	public void setList(List<ContentModel> list) {
+		this.list = list;
+	}
+
+	public List<ContentModel> getList() {
+		return list;
+	}
+
+	public Handler getHandler() {
+		return handler;
+	}
+
+	public void setHandler(Handler handler) {
+		this.handler = handler;
+	}
+
+	public HashMap<String, String> getFilterParams() {
+		return filterParams;
+	}
+
+	public void setFilterParams(HashMap<String, String> filterParams) {
+		this.filterParams = filterParams;
+	}
+
+	/**
+	 * 设置手机网络类型,wifi,cmwap,ctwap,用于联网参数选择
+	 * @return
+	 */
+	static String setNetworkType() {
+		String networkType = "wifi";
+		ConnectivityManager manager = (ConnectivityManager) mInstance
+				.getSystemService(Context.CONNECTIVITY_SERVICE);
+
+		NetworkInfo netWrokInfo = manager.getActiveNetworkInfo();
+		if (netWrokInfo == null || !netWrokInfo.isAvailable()) {
+			// 当前网络不可用
+			return "";
+		}
+
+		String info = netWrokInfo.getExtraInfo();
+		if ((info != null)
+				&& ((info.trim().toLowerCase().equals("cmwap"))
+						|| (info.trim().toLowerCase().equals("uniwap"))
+						|| (info.trim().toLowerCase().equals("3gwap")) || (info
+						.trim().toLowerCase().equals("ctwap")))) {
+			// 上网方式为wap
+			if (info.trim().toLowerCase().equals("ctwap")) {
+				// 电信
+				networkType = "ctwap";
+			} else {
+				networkType = "cmwap";
+			}
+
+		}
+		return networkType;
+	}
+	
+	public void callStatistics(){
+		StatisticsTask task = new StatisticsTask(); 
+		task.execute("http://api.map.baidu.com/images/blank.gif?t=92248538&platform=android&logname=lbsyunduanzu");
+	}
+
+	/*
+	 * 百度统计
+	 */
+	class StatisticsTask extends AsyncTask<String, Integer, String> { 
+		 
+        // 可变长的输入参数,与AsyncTask.exucute()对应 
+        @Override 
+        protected String doInBackground(String... params) { 
+            try { 
+                HttpClient client = new DefaultHttpClient(); 
+                // params[0] 代表连接的url 
+                HttpGet get = new HttpGet(params[0]); 
+                HttpResponse response = client.execute(get); 
+                
+				int status = response.getStatusLine().getStatusCode();
+                if(status == HttpStatus.SC_OK){
+                }
+                // 返回结果 
+                return null; 
+            } catch (Exception e) { 
+                e.printStackTrace(); 
+            } 
+            return null; 
+        } 
+        @Override 
+        protected void onCancelled() { 
+            super.onCancelled(); 
+        } 
+        @Override 
+        protected void onPostExecute(String result) { 
+        } 
+        @Override 
+        protected void onPreExecute() { 
+        } 
+        @Override 
+        protected void onProgressUpdate(Integer... values) { 
+        } 
+    }
+}

+ 234 - 0
android/src/com/baidu/lbs/duanzu/LBSListActivity.java

@@ -0,0 +1,234 @@
+package com.baidu.lbs.duanzu;
+
+import java.io.BufferedInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import android.app.ListActivity;
+import android.content.Context;
+import android.content.Intent;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.net.Uri;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.View.MeasureSpec;
+import android.view.View.OnClickListener;
+import android.view.ViewGroup;
+import android.view.Window;
+import android.widget.AbsListView;
+import android.widget.AbsListView.OnScrollListener;
+import android.widget.BaseAdapter;
+import android.widget.ImageView;
+import android.widget.ListView;
+import android.widget.ProgressBar;
+import android.widget.TextView;
+
+import com.baidu.lbs.duanzu.bdapi.LBSCloudSearch;
+
+/**
+ * 小猪短租tab列表类
+ * @author Lu.Jian
+ *
+ */
+public class LBSListActivity extends ListActivity implements OnScrollListener {
+
+	private ContentAdapter adapter;
+	private List<ContentModel> list = new ArrayList<ContentModel>();
+	public View loadMoreView;
+	public ProgressBar progressBar;
+	private int visibleLastIndex = 0;   //最后的可视项索引 
+	public int totalItem = -1;
+
+	protected void onCreate(Bundle savedInstanceState) {
+		super.onCreate(savedInstanceState);
+		requestWindowFeature(Window.FEATURE_NO_TITLE);
+
+		loadMoreView = getLayoutInflater().inflate(R.layout.list_item_footer, null);
+		progressBar = (ProgressBar)loadMoreView.findViewById(R.id.progressBar);
+		
+		loadMoreView.setOnClickListener(new OnClickListener() {
+			@Override
+			public void onClick(View v) {
+				loadMoreData();
+				progressBar.setVisibility(View.VISIBLE);
+			}
+		});
+		
+		final ListView listView = getListView();
+		listView.setItemsCanFocus(false);
+//		listView.addFooterView(loadMoreView);
+		listView.setOnScrollListener(this);
+		
+		adapter = new ContentAdapter(LBSListActivity.this, list);
+		setListAdapter(adapter);
+
+		DemoApplication app = (DemoApplication) getApplication();
+		app.setList(list);
+		app.setAdapter(adapter);
+		app.setListActivity(this);
+		
+	}
+
+	@Override
+	protected void onStart() {
+		// TODO Auto-generated method stub
+		super.onStart();
+
+	}
+
+
+	/**
+	 * 列表item点击回调
+	 */
+	@Override
+	protected void onListItemClick(ListView l, View v, int position, long id) {
+		View popview = LayoutInflater.from(this).inflate(R.layout.marker_pop, null);
+		popview.setDrawingCacheEnabled(true);
+		//启用绘图缓存   
+		popview.setDrawingCacheEnabled(true);        
+        //调用下面这个方法非常重要,如果没有调用这个方法,得到的bitmap为null   
+		popview.measure(MeasureSpec.makeMeasureSpec(256, MeasureSpec.EXACTLY),  
+                MeasureSpec.makeMeasureSpec(256, MeasureSpec.EXACTLY));  
+        //这个方法也非常重要,设置布局的尺寸和位置   
+		popview.layout(0, 0, popview.getMeasuredWidth(), popview.getMeasuredHeight());  
+        //获得绘图缓存中的Bitmap   
+		popview.buildDrawingCache();   
+		
+		super.onListItemClick(l, v, position, id);
+		
+		String webUrl = list.get(position).getWebUrl();
+		
+		Intent intent= new Intent();       
+	    intent.setAction("android.intent.action.VIEW");   
+	    Uri content_url = Uri.parse(webUrl);  
+	    intent.setData(content_url); 
+	    startActivity(intent);
+	    
+	    //调用百度统计接口
+	    DemoApplication.getInstance().callStatistics();
+	}
+	
+	@Override
+	public void onScrollStateChanged(AbsListView view, int scrollState) {
+		int itemsLastIndex = adapter.getCount() - 1; // 数据集最后一项的索引
+		int lastIndex = itemsLastIndex + 1;
+		if (scrollState == OnScrollListener.SCROLL_STATE_IDLE
+				&& visibleLastIndex == lastIndex) {
+			// 如果是自动加载,可以在这里放置异步加载数据的代码
+		}
+	}
+
+	@Override
+	public void onScroll(AbsListView view, int firstVisibleItem,
+			int visibleItemCount, int totalItemCount) {
+		visibleLastIndex = firstVisibleItem + visibleItemCount - 1;
+		if (totalItemCount == totalItem) {
+			getListView().removeFooterView(loadMoreView);
+		}
+	}
+
+	public class ContentAdapter extends BaseAdapter {
+		private LayoutInflater mInflater;
+		private List<ContentModel> items;
+
+		private ViewHolder holder;
+
+		public ContentAdapter(Context context, List<ContentModel> list) {
+			mInflater = LayoutInflater.from(context);
+
+			items = list;
+		}
+
+		@Override
+		public int getCount() {
+			return items.size();
+		}
+
+		@Override
+		public Object getItem(int position) {
+			return items.get(position);
+		}
+
+		@Override
+		public long getItemId(int position) {
+			return position;
+		}
+
+		@Override
+		public View getView(final int position, View convertView,
+				ViewGroup parent) {
+
+			if (convertView == null) {
+				convertView = mInflater.inflate(R.layout.contentitem, null);
+				holder = new ViewHolder();
+				
+				holder.name = (TextView) convertView.findViewById(R.id.name);
+				holder.addr = (TextView) convertView.findViewById(R.id.addr);
+				holder.distance = (TextView) convertView.findViewById(R.id.distance);
+				holder.price = (TextView) convertView.findViewById(R.id.price);
+				holder.icon = (ImageView) convertView.findViewById(R.id.icon);
+				holder.leaseType = (TextView) convertView.findViewById(R.id.leaseType);
+				
+				convertView.setTag(holder);
+			} else {
+				holder = (ViewHolder) convertView.getTag();
+			}
+
+			// holder.index.setText((String) items.get(position).getIndex());
+			holder.addr.setText((String) items.get(position).getAddr() + "");
+			holder.name.setText((String) items.get(position).getName() + "");
+			holder.distance.setText((String) items.get(position).getDistance()
+					+ "");
+			holder.price.setText((String) items.get(position).getPrice());
+			holder.leaseType.setText((String) items.get(position).getLeaseType());
+			holder.icon.setImageBitmap(getBitmapFromUrl((String) items.get(position).getImageurl()));
+
+			return convertView;
+		}
+
+		/* class ViewHolder */
+		private class ViewHolder {
+			TextView addr;
+			TextView name;
+			TextView distance;
+			TextView price;
+			TextView leaseType;
+			ImageView icon;
+		}
+	}
+
+	private Bitmap getBitmapFromUrl(String imgUrl) {
+		URL url;
+		Bitmap bitmap = null;
+		try {
+			url = new URL(imgUrl);
+			InputStream is = url.openConnection().getInputStream();
+			BufferedInputStream bis = new BufferedInputStream(is);
+			bitmap = BitmapFactory.decodeStream(bis);
+			bis.close();
+		} catch (MalformedURLException e) {
+			e.printStackTrace();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		return bitmap;
+	}
+	
+	/**
+	 * 加载更多数据
+	 */
+	private void loadMoreData() {
+		HashMap<String, String> filterParams = DemoApplication.getInstance().getFilterParams();
+		filterParams.put("page_index", (list.size()/10 + 1) + "");
+		// search type 为 -1,将保持当前的搜索类型
+		LBSCloudSearch.request(-1,filterParams, DemoApplication.getInstance().getHandler(), DemoApplication.networkType);
+	}
+
+}

+ 509 - 0
android/src/com/baidu/lbs/duanzu/MainActivity.java

@@ -0,0 +1,509 @@
+package com.baidu.lbs.duanzu;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.util.HashMap;
+import java.util.List;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import android.app.AlertDialog;
+import android.app.TabActivity;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.res.Resources.NotFoundException;
+import android.location.Location;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+import android.view.KeyEvent;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemSelectedListener;
+import android.widget.ArrayAdapter;
+import android.widget.HorizontalScrollView;
+import android.widget.RadioButton;
+import android.widget.RadioGroup;
+import android.widget.RelativeLayout;
+import android.widget.Spinner;
+import android.widget.TabHost;
+import android.widget.TabWidget;
+import android.widget.TextView;
+import android.widget.Toast;
+import android.widget.ToggleButton;
+
+import com.baidu.lbs.duanzu.LBSListActivity.ContentAdapter;
+import com.baidu.lbs.duanzu.bdapi.LBSCloudSearch;
+import com.baidu.lbs.duanzu.bdapi.LBSMapActivity;
+
+/**
+ * 小猪短租首页tab类
+ * 
+ * @author Lu.Jian
+ * 
+ */
+public class MainActivity extends TabActivity {
+
+	private Context context;
+
+	public static final int MSG_NET_TIMEOUT = 100;
+	public static final int MSG_NET_STATUS_ERROR = 200;
+	public static final int MSG_NET_SUCC = 1;
+
+	private boolean initSearchFlag = false;
+
+	private RelativeLayout progress;
+
+	/*
+	 * 处理网络请求
+	 */
+	private final Handler mHandler = new Handler() {
+		@Override
+		public void handleMessage(Message msg) {
+			progress.setVisibility(View.INVISIBLE);
+			switch (msg.what) {
+			case MSG_NET_TIMEOUT:
+				break;
+			case MSG_NET_STATUS_ERROR:
+				break;
+			case MSG_NET_SUCC:
+				initSearchFlag = true;
+				String result = msg.obj.toString();
+				try {
+					JSONObject json = new JSONObject(result);
+					parser(json);
+				} catch (JSONException e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+				}
+				break;
+
+			}
+		}
+	};
+
+	@Override
+	protected void onCreate(Bundle savedInstanceState) {
+		super.onCreate(savedInstanceState);
+		context = this;
+
+		setContentView(R.layout.activity_main);
+		progress = (RelativeLayout) findViewById(R.id.progress);
+
+		// 初始化tab页(列表,附近)
+		initTabHost();
+
+		// 初始化筛选条件(区域,价格,类型)
+		initSpinner();
+
+		// 初始化切换按钮(筛选,附近)
+		initToggleButton();
+
+		// 初始化附近范围(1000米,3000米,5000米)
+		initRadioGroup();
+
+		// 发起搜索请求
+		search();
+
+		DemoApplication.getInstance().setHandler(mHandler);
+	}
+
+	@Override
+	protected void onStart() {
+		// TODO Auto-generated method stub
+		super.onStart();
+	}
+
+	public void onDestroy() {
+		// TODO Auto-generated method stub
+		super.onDestroy();
+	}
+
+	/*
+	 * 添加对back按钮的处理,点击提示退出
+	 * (non-Javadoc)
+	 * @see android.app.Activity#dispatchKeyEvent(android.view.KeyEvent)
+	 */
+	@Override
+	public boolean dispatchKeyEvent(KeyEvent event) {
+		if (event.getKeyCode() == KeyEvent.KEYCODE_BACK
+				&& event.getAction() != 1) {
+			exit();
+			return true;
+		}
+
+		return super.dispatchKeyEvent(event);
+	}
+
+	private void initRadioGroup() {
+		RadioGroup filter2 = (RadioGroup) findViewById(R.id.filter2);
+
+		// 附近搜索 选择不同距离的点击事件
+		filter2.setOnCheckedChangeListener(new android.widget.RadioGroup.OnCheckedChangeListener() {
+			@Override
+			public void onCheckedChanged(android.widget.RadioGroup arg0,
+					int arg1) {
+				search(LBSCloudSearch.SEARCH_TYPE_NEARBY);
+			}
+		});
+	}
+
+	private void initToggleButton() {
+		ToggleButton toggleButton = (ToggleButton) findViewById(R.id.toggleButton1);
+		// 添加toggle button点击事件
+		toggleButton
+				.setOnCheckedChangeListener(new android.widget.CompoundButton.OnCheckedChangeListener() {
+
+					@Override
+					public void onCheckedChanged(
+							android.widget.CompoundButton arg0, boolean arg1) {
+						TextView textView1 = (TextView) findViewById(R.id.toggle_text1);
+						TextView textView2 = (TextView) findViewById(R.id.toggle_text2);
+						HorizontalScrollView filter1 = (HorizontalScrollView) findViewById(R.id.filter1);
+						RadioGroup filter2 = (RadioGroup) findViewById(R.id.filter2);
+
+						if (arg1) {
+							// 显示附近
+							textView1.setVisibility(View.INVISIBLE);
+							filter1.setVisibility(View.INVISIBLE);
+
+							textView2.setVisibility(View.VISIBLE);
+							filter2.setVisibility(View.VISIBLE);
+							search(LBSCloudSearch.SEARCH_TYPE_NEARBY);
+						} else {
+							// 显示筛选
+							textView1.setVisibility(View.VISIBLE);
+							filter1.setVisibility(View.VISIBLE);
+
+							textView2.setVisibility(View.INVISIBLE);
+							filter2.setVisibility(View.INVISIBLE);
+							search();
+						}
+						
+					}
+				});
+
+	}
+
+	private void initTabHost() {
+		final TabHost tabHost = getTabHost();
+
+		// 添加列表tab和地图tab
+		tabHost.addTab(tabHost.newTabSpec("tab1")
+				.setIndicator(getString(R.string.tab_1_text))
+				.setContent(new Intent(this, LBSListActivity.class)));
+		tabHost.addTab(tabHost.newTabSpec("tab2")
+				.setIndicator(getString(R.string.tab_2_text))
+				.setContent(new Intent(this, LBSMapActivity.class)));
+
+		TabWidget tabWidget = tabHost.getTabWidget();
+
+		// 将tab的图文组合改为文字显示并调整tab高度
+		for (int i = 0; i < tabWidget.getChildCount(); i++) {
+			View child = tabWidget.getChildAt(i);
+
+			final TextView tv = (TextView) child
+					.findViewById(android.R.id.title);
+
+			RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) tv
+					.getLayoutParams();
+			params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, 0); // 取消文字底边对齐
+			params.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE); // 设置文字居中对齐
+
+			child.getLayoutParams().height = 60; // hard code
+		}
+
+	}
+
+	private void initSpinner() {
+
+		final Spinner s1 = (Spinner) findViewById(R.id.spinner1);
+		final Spinner s2 = (Spinner) findViewById(R.id.spinner2);
+		final Spinner s3 = (Spinner) findViewById(R.id.spinner3);
+
+		// 设置区域过滤下拉框
+		ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
+				this, R.array.region, android.R.layout.simple_spinner_item);
+		adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+		s1.setAdapter(adapter);
+		s1.setOnItemSelectedListener(new OnItemSelectedListener() {
+			public void onItemSelected(AdapterView<?> parent, View view,
+					int position, long id) {
+				if (initSearchFlag) {
+					search();
+				}
+			}
+
+			public void onNothingSelected(AdapterView<?> parent) {
+			}
+		});
+
+		// 设置价格过滤下拉框
+		adapter = ArrayAdapter.createFromResource(this, R.array.price,
+				android.R.layout.simple_spinner_item);
+		adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+		s2.setAdapter(adapter);
+		s2.setOnItemSelectedListener(new OnItemSelectedListener() {
+			public void onItemSelected(AdapterView<?> parent, View view,
+					int position, long id) {
+				if (initSearchFlag) {
+					search();
+				}
+			}
+
+			public void onNothingSelected(AdapterView<?> parent) {
+			}
+		});
+
+		// 设置短租类型下拉框
+		adapter = ArrayAdapter.createFromResource(this, R.array.category,
+				android.R.layout.simple_spinner_item);
+		adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+		s3.setAdapter(adapter);
+		s3.setOnItemSelectedListener(new OnItemSelectedListener() {
+			public void onItemSelected(AdapterView<?> parent, View view,
+					int position, long id) {
+				if (initSearchFlag) {
+					search();
+				}
+			}
+
+			public void onNothingSelected(AdapterView<?> parent) {
+			}
+		});
+	}
+
+	/*
+	 * 云检索发起
+	 */
+	private void search() {
+		search(LBSCloudSearch.SEARCH_TYPE_LOCAL);
+	}
+	
+	/*
+	 * 根据搜索类型发起检索
+	 */
+	private void search(int searchType){
+		progress.setVisibility(View.VISIBLE);
+		DemoApplication app = DemoApplication.getInstance();
+		app.getList().clear(); // 搜索钱清空列表
+		app.getListActivity().loadMoreView.setVisibility(View.INVISIBLE);
+		if (app.getListActivity().getListView().getFooterViewsCount() == 0) {
+			// 点击查看更多按钮添加
+			app.getListActivity().getListView()
+					.addFooterView(app.getListActivity().loadMoreView);
+		}
+
+		app.getListActivity().getListView().setAdapter(app.getAdapter());
+
+		// 云检索发起
+		LBSCloudSearch.request(searchType, getRequestParams(), mHandler,
+				DemoApplication.networkType);
+	}
+
+	/*
+	 * 获取云检索参数
+	 */
+	private HashMap<String, String> getRequestParams() {
+		HashMap<String, String> map = new HashMap<String, String>();
+
+		Spinner s1 = (Spinner) findViewById(R.id.spinner1);
+		Spinner s2 = (Spinner) findViewById(R.id.spinner2);
+		Spinner s3 = (Spinner) findViewById(R.id.spinner3);
+
+		ToggleButton toggleButton = (ToggleButton) findViewById(R.id.toggleButton1);
+
+		try {
+			map.put("region", URLEncoder.encode("北京", "utf-8"));
+
+			String filter = "";
+
+			if (toggleButton.isChecked()) {
+				// 附件,周边搜索
+				RadioGroup filter2 = (RadioGroup) findViewById(R.id.filter2);
+				RadioButton rb = (RadioButton) findViewById(filter2
+						.getCheckedRadioButtonId());
+				String radius = rb.getText().toString();
+				radius = radius.substring(0, radius.length() - 1);
+				map.put("radius", radius);
+
+				DemoApplication app = DemoApplication.getInstance();
+				if (app.currlocation != null) {
+					map.put("location", app.currlocation.getLongitude() + ","
+							+ app.currlocation.getLatitude());
+				} else {
+					// 无定位数据默认北京中心
+					double cLat = 39.909230;
+					double cLon = 116.397428;
+					map.put("location", cLat + "," + cLon);
+				}
+			} else {
+				// 筛选,本地搜索
+				if (s1.getSelectedItemPosition() > 0) {
+					String s1String = s1.getSelectedItem().toString();
+					map.put("q", URLEncoder.encode(s1String, "utf-8"));
+				}
+
+				if (s2.getSelectedItemPosition() > 0) {
+					String s2String = s2.getSelectedItem().toString();
+					String[] priceArray = context.getResources()
+							.getStringArray(R.array.price);
+					for (int i = 0; i < priceArray.length; i++) {
+						if (s2String.equals(priceArray[i])) {
+							if (i == priceArray.length - 1) {
+								filter = filter
+										+ URLEncoder.encode("|", "utf-8")
+										+ "dayprice:" + (i - 1) * 50
+										+ URLEncoder.encode(",", "utf-8")
+										+ 10000;
+							} else {
+								filter = filter
+										+ URLEncoder.encode("|", "utf-8")
+										+ "dayprice:" + (i - 1) * 50
+										+ URLEncoder.encode(",", "utf-8") + i
+										* 50;
+							}
+
+							break;
+						}
+					}
+				}
+
+				if (s3.getSelectedItemPosition() > 0) {
+					String s3String = s3.getSelectedItem().toString();
+					String[] categoryArray = context.getResources()
+							.getStringArray(R.array.category);
+					for (int i = 0; i < categoryArray.length; i++) {
+						if (s3String.equals(categoryArray[i])) {
+							filter = filter + URLEncoder.encode("|", "utf-8")
+									+ "leasetype:" + i
+									+ URLEncoder.encode(",", "utf-8") + i;
+							break;
+						}
+					}
+				}
+			}
+
+			map.put("filter", filter);
+
+		} catch (UnsupportedEncodingException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (NotFoundException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+
+		DemoApplication.getInstance().setFilterParams(map);
+
+		return map;
+	}
+
+	/*
+	 * 解析返回数据
+	 */
+	private void parser(JSONObject json) {
+		DemoApplication app = (DemoApplication) getApplication();
+		List<ContentModel> list = app.getList();
+
+		try {
+			app.getListActivity().totalItem = json.getInt("total");
+
+			JSONArray jsonArray = json.getJSONArray("contents");
+			if (jsonArray != null && jsonArray.length() <= 0) {
+				Toast.makeText(context, "没有符合要求的数据", Toast.LENGTH_SHORT).show();
+			} else {
+				for (int i = 0; i < jsonArray.length(); i++) {
+					JSONObject jsonObject2 = (JSONObject) jsonArray.opt(i);
+					ContentModel content = new ContentModel();
+					content.setName(jsonObject2.getString("title"));
+					content.setAddr(jsonObject2.getString("address"));
+
+					content.setDistance(jsonObject2.getString("distance") + "米");
+
+//					double latitude = jsonObject2.getDouble("latitude");
+//					double longitude = jsonObject2.getDouble("longitude");
+					JSONArray locArray = jsonObject2.getJSONArray("location");
+					double latitude = locArray.getDouble(1);
+					double longitude = locArray.getDouble(0);
+					content.setLatitude(latitude);
+					content.setLongitude(longitude);
+
+					float results[] = new float[1];
+
+					if (app.currlocation != null) {
+						Location.distanceBetween(
+								app.currlocation.getLatitude(),
+								app.currlocation.getLongitude(), latitude,
+								longitude, results);
+					}
+					content.setDistance((int) results[0] + "米");
+
+//					JSONObject jsonObject3 = jsonObject2.getJSONObject("ext");
+//					content.setPrice(jsonObject3.getString("dayprice"));
+//					content.setImageurl(jsonObject3.getString("mainimage"));
+//					content.setWebUrl(jsonObject3.getString("roomurl"));
+//					int leasetype = jsonObject3.getInt("leasetype");
+					content.setPrice(jsonObject2.getString("dayprice"));
+					content.setImageurl(jsonObject2.getString("mainimage"));
+					content.setWebUrl(jsonObject2.getString("roomurl"));
+					int leasetype = jsonObject2.getInt("leasetype");
+					
+					
+					String[] categoryArray = context.getResources()
+							.getStringArray(R.array.category);
+					if(leasetype > categoryArray.length -1){
+						leasetype = 1;
+					}
+					content.setLeaseType(categoryArray[leasetype]);
+					list.add(content);
+
+
+				}
+
+			}
+			if (list.size() < 10) {
+				app.getListActivity().getListView()
+						.removeFooterView(app.getListActivity().loadMoreView);
+			}
+		} catch (JSONException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+
+		ContentAdapter adapter = ((DemoApplication) getApplication())
+				.getAdapter();
+		if (adapter != null) {
+			adapter.notifyDataSetChanged();
+			app.getListActivity().loadMoreView.setVisibility(View.VISIBLE);
+			app.getListActivity().progressBar.setVisibility(View.INVISIBLE);
+		}
+		if (app.getMapActivity() != null) {
+			app.getMapActivity().removeAllMarker();
+			app.getMapActivity().addAllMarker();
+		}
+	}
+
+	/*
+	 * 退出应用程序
+	 */
+	private void exit() {
+		new AlertDialog.Builder(MainActivity.this)
+				.setMessage(R.string.exit_confirm)
+				.setPositiveButton(R.string.button_ok,
+						new DialogInterface.OnClickListener() {
+
+							public void onClick(DialogInterface dialog,
+									int whichButton) {
+								finish();
+								android.os.Process
+										.killProcess(android.os.Process.myPid());
+							}
+						}).setNegativeButton(R.string.button_cancel, null)
+				.show();
+	}
+
+}

+ 173 - 0
android/src/com/baidu/lbs/duanzu/bdapi/LBSCloudSearch.java

@@ -0,0 +1,173 @@
+package com.baidu.lbs.duanzu.bdapi;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.http.Header;
+import org.apache.http.HttpHost;
+import org.apache.http.HttpResponse;
+import org.apache.http.HttpStatus;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.conn.params.ConnRoutePNames;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.params.CoreConnectionPNames;
+import org.apache.http.params.HttpProtocolParams;
+import org.apache.http.util.EntityUtils;
+
+import android.os.Handler;
+import android.os.Message;
+import android.util.Log;
+import com.baidu.lbs.duanzu.MainActivity;
+
+
+/**
+ * 百度云检索使用类
+ * @author Lu.Jian
+ *
+ */
+public class LBSCloudSearch {
+	
+	//百度云检索API URI
+	private static final String SEARCH_URI_NEARBY = "http://api.map.baidu.com/geosearch/v2/nearby?";
+	private static final String SEARCH_URI_LOCAL = "http://api.map.baidu.com/geosearch/v2/local?";
+	
+	public static final int SEARCH_TYPE_NEARBY = 1;
+	public static final int SEARCH_TYPE_LOCAL = 2;
+	
+	private static int currSearchType = 0;
+	
+	//云检索公钥
+	private static String ak = "A4749739227af1618f7b0d1b588c0e85";
+	
+	private static String geotable_id = "30960";
+
+	private static int TIME_OUT = 12000;
+	private static int retry = 3;
+	private static boolean IsBusy = false;
+	
+	/**
+	 * 云检索访问
+	 * @param filterParams	访问参数,key为filter时特殊处理。
+	 * @param handler		数据回调Handler
+	 * @param networkType	手机联网类型
+	 * @return
+	 */
+	public static boolean request(final int searchType,final HashMap<String, String> filterParams,final Handler handler, final String networkType) {
+		if (IsBusy || filterParams == null)
+			return false;
+		IsBusy = true;
+		
+		new Thread() {
+			public void run() {
+				int count = retry;
+				while (count > 0){
+					try {
+						
+						//根据过滤选项拼接请求URL
+						String requestURL = "";
+						if(searchType == -1){
+							//沿用上次搜索保存的search type
+							if(currSearchType == SEARCH_TYPE_NEARBY){
+								requestURL = SEARCH_URI_NEARBY;
+							}else if(currSearchType == SEARCH_TYPE_LOCAL){
+								requestURL = SEARCH_URI_LOCAL;
+							}
+						}else{
+							if(searchType == SEARCH_TYPE_NEARBY){
+								requestURL = SEARCH_URI_NEARBY;
+							}else if(searchType == SEARCH_TYPE_LOCAL){
+								requestURL = SEARCH_URI_LOCAL;
+							}
+							currSearchType = searchType;
+						}
+						requestURL = requestURL   + "&"
+										+ "ak=" + ak
+										+ "&geotable_id=" + geotable_id; 
+						
+						String filter = null;
+						Iterator iter = filterParams.entrySet().iterator();
+						while (iter.hasNext()) {
+							Map.Entry entry = (Map.Entry) iter.next();
+							String key = entry.getKey().toString();
+							String value = entry.getValue().toString();
+							
+							if(key.equals("filter")){
+								filter = value;
+							}else{
+								if(key.equals("region") && currSearchType == SEARCH_TYPE_NEARBY){
+									continue;
+								}
+								requestURL = requestURL + "&" + key + "=" + value;
+							}
+						}
+						
+						if(filter != null && !filter.equals("")){
+							//substring(3) 为了去掉"|" 的encode  "%7C"
+							requestURL = requestURL + "&filter=" + filter.substring(3);
+						}
+						
+						Log.d("DuanZuLog", "request url:" + requestURL);
+						
+						HttpGet httpRequest = new HttpGet(requestURL);
+						HttpClient httpclient = new DefaultHttpClient();
+						httpclient.getParams().setParameter(
+								CoreConnectionPNames.CONNECTION_TIMEOUT, TIME_OUT);
+						httpclient.getParams().setParameter(
+								CoreConnectionPNames.SO_TIMEOUT, TIME_OUT);
+						
+						HttpProtocolParams.setUseExpectContinue(httpclient.getParams(), false);
+						
+						if(networkType.equals("cmwap")){
+							HttpHost proxy = new HttpHost("10.0.0.172", 80, "http");
+							httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY,
+									proxy);
+						}else if(networkType.equals("ctwap")){
+							HttpHost proxy = new HttpHost("10.0.0.200", 80, "http");
+							httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY,
+									proxy);
+						}
+
+
+						HttpResponse httpResponse = httpclient.execute(httpRequest);
+						int status = httpResponse.getStatusLine().getStatusCode();
+						if ( status == HttpStatus.SC_OK ) {
+							
+							String result = EntityUtils.toString(httpResponse
+									.getEntity(), "utf-8");
+//							Header a = httpResponse.getEntity().getContentType();
+							Message msgTmp = handler.obtainMessage(MainActivity.MSG_NET_SUCC);
+							msgTmp.obj = result;
+							msgTmp.sendToTarget();
+							
+
+							break;
+						} else {
+							httpRequest.abort();
+							Message msgTmp = handler.obtainMessage(MainActivity.MSG_NET_STATUS_ERROR);
+							msgTmp.obj = "HttpStatus error";
+							msgTmp.sendToTarget();
+						}
+					} catch (Exception e) {
+						Log.e("DuanZuLog", "网络异常,请检查网络后重试!");
+						e.printStackTrace();
+					}
+					
+					count--;
+				}
+				
+				if ( count <= 0 && handler != null){
+					Message msgTmp =  handler.obtainMessage(MainActivity.MSG_NET_TIMEOUT);
+					msgTmp.sendToTarget();
+				}
+				
+				IsBusy = false;
+				
+			}
+		}.start();
+
+		return true;
+	}
+	
+}

+ 86 - 0
android/src/com/baidu/lbs/duanzu/bdapi/LBSLocation.java

@@ -0,0 +1,86 @@
+package com.baidu.lbs.duanzu.bdapi;
+
+import android.location.Location;
+
+import com.baidu.lbs.duanzu.ContentModel;
+import com.baidu.lbs.duanzu.DemoApplication;
+import com.baidu.location.BDLocation;
+import com.baidu.location.BDLocationListener;
+import com.baidu.location.LocationClient;
+import com.baidu.location.LocationClientOption;
+
+/**
+ * 百度定位API使用类,启动定位,当返回定位结果是停止定位
+ * 
+ * @author Lu.Jian
+ * 
+ */
+public class LBSLocation {
+
+	private static LBSLocation location = null;
+	private static DemoApplication app = null;
+
+	private MyLocationListenner myListener = new MyLocationListenner();
+	public LocationClient mLocationClient = null;
+
+	public static LBSLocation getInstance(DemoApplication application) {
+		app = application;
+		if (location == null) {
+			location = new LBSLocation(app);
+		}
+
+		return location;
+	}
+
+	private LBSLocation(DemoApplication app) {
+		mLocationClient = new LocationClient(app);
+		mLocationClient.registerLocationListener(myListener);
+		mLocationClient.start();
+	}
+
+	/**
+	 * 开始定位请求,结果在回调中
+	 */
+	public void startLocation() {
+		LocationClientOption option = new LocationClientOption();
+		option.setOpenGps(true);
+		option.setAddrType("all");// 返回的定位结果包含地址信息
+		option.setCoorType("bd09ll");// 返回的定位结果是百度经纬度,默认值gcj02
+		option.disableCache(true);// 禁止启用缓存定位
+		mLocationClient.setLocOption(option);
+		mLocationClient.requestLocation();
+	}
+
+	/**
+	 * 监听函数,有新位置的时候,格式化成字符串,输出到屏幕中
+	 */
+	public class MyLocationListenner implements BDLocationListener {
+		@Override
+		public void onReceiveLocation(BDLocation location) {
+			if (location == null)
+				return;
+			app.currlocation = location;
+			mLocationClient.stop();
+			
+			//根据当前位置,计算列表中每一项的距离
+			for (ContentModel content : app.getList()) {
+
+				float results[] = new float[1];
+				if (location != null) {
+					Location.distanceBetween(location.getLatitude(),
+							location.getLongitude(), content.getLatitude(),
+							content.getLongitude(), results);
+				}
+				int distance = (int) results[0];
+				content.setDistance(distance == 0 ? "" : (int) results[0] + "米");
+			}
+			//刷新列表
+			app.getAdapter().notifyDataSetChanged();
+			
+		}
+
+		public void onReceivePoi(BDLocation poiLocation) {
+
+		}
+	}
+}

+ 326 - 0
android/src/com/baidu/lbs/duanzu/bdapi/LBSMapActivity.java

@@ -0,0 +1,326 @@
+package com.baidu.lbs.duanzu.bdapi;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+import android.graphics.Bitmap;
+import android.graphics.drawable.Drawable;
+import android.net.Uri;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.View.MeasureSpec;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.baidu.lbs.duanzu.ContentModel;
+import com.baidu.lbs.duanzu.DemoApplication;
+import com.baidu.lbs.duanzu.R;
+import com.baidu.mapapi.BMapManager;
+import com.baidu.mapapi.MKGeneralListener;
+import com.baidu.mapapi.map.ItemizedOverlay;
+import com.baidu.mapapi.map.LocationData;
+import com.baidu.mapapi.map.MKEvent;
+import com.baidu.mapapi.map.MapController;
+import com.baidu.mapapi.map.MapView;
+import com.baidu.mapapi.map.MyLocationOverlay;
+import com.baidu.mapapi.map.OverlayItem;
+import com.baidu.mapapi.map.PopupClickListener;
+import com.baidu.mapapi.map.PopupOverlay;
+import com.baidu.platform.comapi.basestruct.GeoPoint;
+
+/**
+ * 小猪短租tab地图类
+ * 
+ * @author Lu.Jian
+ * 
+ */
+public class LBSMapActivity extends Activity {
+	private Context context;
+
+	public BMapManager mBMapManager = null;
+	public MapView mMapView = null;
+	public static final String strKey = "63418012748CD126610D926A0546374D0BFC86D5";
+
+	@Override
+	protected void onCreate(Bundle savedInstanceState) {
+		super.onCreate(savedInstanceState);
+		context = this;
+
+		initEngineManager(this);
+		
+		setContentView(R.layout.map);
+		
+		initMapView();
+
+		DemoApplication.getInstance().setMapActivity(this);
+	}
+
+	@Override
+	// 建议在您app的退出之前调用mapadpi的destroy()函数,避免重复初始化带来的时间消耗
+	public void onDestroy() {
+		// TODO Auto-generated method stub
+		if (mBMapManager != null) {
+			mBMapManager.destroy();
+			mBMapManager = null;
+		}
+		super.onDestroy();
+	}
+
+	@Override
+	protected void onStart() {
+		// TODO Auto-generated method stub
+		super.onStart();
+	}
+
+	@Override
+	protected void onStop() {
+		// TODO Auto-generated method stub
+		super.onStop();
+	}
+
+	@Override
+	protected void onPause() {
+		mMapView.onPause();
+		if (mBMapManager != null) {
+			mBMapManager.stop();
+		}
+		removeAllMarker();
+		super.onPause();
+	}
+
+	@Override
+	protected void onResume() {
+		mMapView.onResume();
+		if (mBMapManager != null) {
+			mBMapManager.start();
+		}
+		addAllMarker();
+		super.onResume();
+	}
+
+	public void initEngineManager(Context context) {
+		if (mBMapManager == null) {
+			mBMapManager = new BMapManager(context);
+		}
+
+		if (!mBMapManager.init(strKey, new MyGeneralListener())) {
+			Toast.makeText(context, "BMapManager  初始化错误!", Toast.LENGTH_LONG)
+					.show();
+		}
+	}
+
+	// 常用事件监听,用来处理通常的网络错误,授权验证错误等
+	class MyGeneralListener implements MKGeneralListener {
+
+		@Override
+		public void onGetNetworkState(int iError) {
+			if (iError == MKEvent.ERROR_NETWORK_CONNECT) {
+				Toast.makeText(context, "您的网络出错啦!", Toast.LENGTH_LONG).show();
+			} else if (iError == MKEvent.ERROR_NETWORK_DATA) {
+				Toast.makeText(context, "输入正确的检索条件!", Toast.LENGTH_LONG).show();
+			}
+		}
+
+		@Override
+		public void onGetPermissionState(int iError) {
+			if (iError == MKEvent.ERROR_PERMISSION_DENIED) {
+				// 授权Key错误:
+				Toast.makeText(context, "请在 DemoApplication.java文件输入正确的授权Key!",
+						Toast.LENGTH_LONG).show();
+			}
+		}
+	}
+
+	private void initMapView() {
+
+		mMapView = (MapView) findViewById(R.id.bmapView);
+		mMapView.setBuiltInZoomControls(true);
+		// 设置启用内置的缩放控件
+		MapController mMapController = mMapView.getController();
+		// 得到mMapView的控制权,可以用它控制和驱动平移和缩放
+		GeoPoint point = new GeoPoint((int) (39.915 * 1E6),
+				(int) (116.404 * 1E6));
+		// 用给定的经纬度构造一个GeoPoint,单位是微度 (度 * 1E6)
+		mMapController.setCenter(point);// 设置地图中心点
+		mMapController.setZoom(13);// 设置地图zoom级别
+
+	}
+
+	/**
+	 * 删除所有标记
+	 */
+	public void removeAllMarker() {
+		mMapView.getOverlays().clear();
+		mMapView.refresh();
+
+	}
+
+	/**
+	 * 添加所有标记
+	 */
+	public void addAllMarker() {
+		DemoApplication app = (DemoApplication) getApplication();
+		List<ContentModel> list = app.getList();
+		mMapView.getOverlays().clear();
+		OverlayIcon ov = new OverlayIcon(null, this);
+		for (ContentModel content : list) {
+			int latitude = (int) (content.getLatitude() * 1000000);
+			int longitude = (int) (content.getLongitude() * 1000000);
+
+			Drawable d = getResources().getDrawable(R.drawable.icon_marka);
+			OverlayItem item = new OverlayItem(
+					new GeoPoint(latitude, longitude), content.getName(),
+					content.getAddr());
+			item.setMarker(d);
+
+			ov.addItem(item);
+		}
+		mMapView.getOverlays().add(ov);
+		mMapView.refresh();
+		
+		//如果定位成功,添加当前坐标点
+		if (app.currlocation != null)
+    	{
+			MyLocationOverlay myLocationOverlay = new MyLocationOverlay(mMapView);
+			LocationData locData = new LocationData();
+			//手动将位置源置为天安门,在实际应用中,请使用百度定位SDK获取位置信息,要在SDK中显示一个位置,需要
+			//		使用百度经纬度坐标(bd09ll)
+			locData.latitude = app.currlocation.getLatitude();
+			locData.longitude = app.currlocation.getLongitude();
+			locData.direction = 2.0f;
+			myLocationOverlay.setData(locData);
+			mMapView.getOverlays().add(myLocationOverlay);
+			mMapView.refresh();
+    	}
+
+
+		// 北京的中心,无定位时的地图中心
+		int cLat = 39909230;
+		int cLon = 116397428;
+		if (app.currlocation == null) {
+			mMapView.getController().setCenter(new GeoPoint(cLat, cLon));
+		} else if (list != null && list.size() >= 1) {
+			ContentModel c = (ContentModel)list.get(0);
+			int currLat = (int) (c.getLatitude() * 1000000);
+			int currLon = (int) (c.getLongitude() * 1000000);
+			mMapView.getController().setCenter(new GeoPoint(currLat, currLon));
+		}
+	}
+
+	/**
+	 * 地图覆盖物,用于显示标记
+	 *
+	 */
+	class OverlayIcon extends ItemizedOverlay<OverlayItem> {
+		public List<OverlayItem> mGeoList = new ArrayList<OverlayItem>();
+		private Context mContext = null;
+		PopupOverlay pop = null;
+
+		final List<ContentModel> list = DemoApplication.getInstance().getList();
+
+		private int clickedTapIndex = -1;
+
+		public OverlayIcon(Drawable marker, Context context) {
+			super(marker);
+			this.mContext = context;
+			pop = new PopupOverlay(mMapView, new PopupClickListener() {
+
+				/*
+				 * 标记的弹出框被点击后回调
+				 * (non-Javadoc)
+				 * @see com.baidu.mapapi.map.PopupClickListener#onClickedPopup()
+				 */
+				@Override
+				public void onClickedPopup() {
+					String webUrl = list.get(clickedTapIndex).getWebUrl();
+
+					Intent intent = new Intent();
+					intent.setAction("android.intent.action.VIEW");
+					Uri content_url = Uri.parse(webUrl);
+					intent.setData(content_url);
+					startActivity(intent);
+					
+				    //调用百度统计接口
+				    DemoApplication.getInstance().callStatistics();
+
+				}
+			});
+			populate();
+
+		}
+
+		/*
+		 * 覆盖物点击回调
+		 * (non-Javadoc)
+		 * @see com.baidu.mapapi.map.ItemizedOverlay#onTap(int)
+		 */
+		protected boolean onTap(int index) {
+			if(index >= list.size()){
+				//点击自己位置marker,不做任何处理
+				return true;
+			}
+			clickedTapIndex = index;
+			View popview = LayoutInflater.from(mContext).inflate(
+					R.layout.marker_pop, null);
+			TextView textV = (TextView) popview.findViewById(R.id.text_pop);
+			String text = list.get(index).getName();
+			textV.setText(text);
+
+			pop.showPopup(convertViewToBitMap(popview), mGeoList.get(index)
+					.getPoint(), 28);
+			super.onTap(index);
+			return false;
+		}
+
+		/*
+		 * 覆盖物其他区域点击回调 
+		 */
+		public boolean onTap(GeoPoint pt, MapView mapView) {
+			if (pop != null) {
+				clickedTapIndex = -1;
+				pop.hidePop();
+			}
+			super.onTap(pt, mapView);
+			return false;
+		}
+
+		@Override
+		protected OverlayItem createItem(int i) {
+			return mGeoList.get(i);
+		}
+
+		@Override
+		public int size() {
+			return mGeoList.size();
+		}
+
+		public void addItem(OverlayItem item) {
+			mGeoList.add(item);
+			populate();
+		}
+
+		public void removeItem(int index) {
+			mGeoList.remove(index);
+			populate();
+		}
+
+		private Bitmap convertViewToBitMap(View v) {
+			// 启用绘图缓存
+			v.setDrawingCacheEnabled(true);
+			// 调用下面这个方法非常重要,如果没有调用这个方法,得到的bitmap为null
+			v.measure(MeasureSpec.makeMeasureSpec(210, MeasureSpec.EXACTLY),
+					MeasureSpec.makeMeasureSpec(120, MeasureSpec.EXACTLY));
+			// 这个方法也非常重要,设置布局的尺寸和位置
+			v.layout(0, 0, v.getMeasuredWidth() +20, v.getMeasuredHeight());
+			// 获得绘图缓存中的Bitmap
+			v.buildDrawingCache();
+			return v.getDrawingCache();
+		}
+
+	}
+
+}