全面更新
Showing
2 changed files
with
58 additions
and
5 deletions
... | @@ -16,7 +16,12 @@ | ... | @@ -16,7 +16,12 @@ |
16 | android:label="@string/app_name" | 16 | android:label="@string/app_name" |
17 | android:supportsRtl="true" | 17 | android:supportsRtl="true" |
18 | android:theme="@style/AppTheme"> | 18 | android:theme="@style/AppTheme"> |
19 | <activity android:name=".BootActivity" /> | 19 | <activity android:name=".BootActivity" > |
20 | <intent-filter> | ||
21 | <action android:name="android.intent.action.MAIN" /> | ||
22 | <category android:name="android.intent.category.LAUNCHER" /> | ||
23 | </intent-filter> | ||
24 | </activity> | ||
20 | <activity | 25 | <activity |
21 | android:name=".MainActivity" | 26 | android:name=".MainActivity" |
22 | android:label="@string/app_name" | 27 | android:label="@string/app_name" |
... | @@ -27,10 +32,7 @@ | ... | @@ -27,10 +32,7 @@ |
27 | 32 | ||
28 | </activity> | 33 | </activity> |
29 | <activity android:name=".BaiduMapActivity"> | 34 | <activity android:name=".BaiduMapActivity"> |
30 | <intent-filter> | 35 | |
31 | <action android:name="android.intent.action.MAIN" /> | ||
32 | <category android:name="android.intent.category.LAUNCHER" /> | ||
33 | </intent-filter> | ||
34 | </activity> | 36 | </activity> |
35 | </application> | 37 | </application> |
36 | 38 | ... | ... |
1 | package com.pashanhoo.landsurvey.search; | ||
2 | |||
3 | import com.androidnetworking.AndroidNetworking; | ||
4 | import com.androidnetworking.error.ANError; | ||
5 | import com.androidnetworking.interfaces.JSONObjectRequestListener; | ||
6 | |||
7 | import org.json.JSONArray; | ||
8 | import org.json.JSONException; | ||
9 | import org.json.JSONObject; | ||
10 | |||
11 | import java.util.ArrayList; | ||
12 | |||
13 | public class TiandituSearch { | ||
14 | private static ArrayList<POISuggestion> poiSuggestionArrayList = new ArrayList<POISuggestion>(); | ||
15 | |||
16 | public static ArrayList<POISuggestion> getPoi(String name){ | ||
17 | |||
18 | String str = "{\"keyWord\":\"" + name + "\",\"level\":\"11\",\"mapBound\":" + | ||
19 | "\"76.24832,30.1129,156.40458,49.97618\",\"queryType\":\"1\",\"count\":\"10\"" + | ||
20 | ",\"start\":\"0\",\"queryTerminal\":\"1000\"}"; | ||
21 | |||
22 | AndroidNetworking.post("http://map.tianditu.com/query.shtml") | ||
23 | .addBodyParameter("type", "query") | ||
24 | .addBodyParameter("postStr", str) | ||
25 | .setTag("test") | ||
26 | .build() | ||
27 | .getAsJSONObject(new JSONObjectRequestListener() { | ||
28 | @Override | ||
29 | public void onResponse(JSONObject response) { | ||
30 | try { | ||
31 | JSONArray jsonArray = response.getJSONArray("pois"); | ||
32 | |||
33 | for (int i = 0; i < jsonArray.length(); i++) { | ||
34 | JSONObject Jasonobject = jsonArray.getJSONObject(i); | ||
35 | poiSuggestionArrayList.add(new POISuggestion(Jasonobject.getString("name"), | ||
36 | Jasonobject.getString("address"), | ||
37 | Jasonobject.getString("lonlat"))); | ||
38 | } | ||
39 | } catch (JSONException e) { | ||
40 | e.printStackTrace(); | ||
41 | } | ||
42 | } | ||
43 | |||
44 | @Override | ||
45 | public void onError(ANError anError) { | ||
46 | poiSuggestionArrayList = null; | ||
47 | } | ||
48 | }); | ||
49 | return poiSuggestionArrayList; | ||
50 | } | ||
51 | } |
-
Please register or sign in to post a comment