Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
蒋波涛
/
landsurvey
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
62e1fc5c
authored
2018-03-31 10:02:10 +0800
by
chiangbt
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
全面更新
1 parent
eeafb1ff
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
5 deletions
app/src/main/AndroidManifest.xml
app/src/main/java/com/pashanhoo/landsurvey/search/TiandituSearch.java
app/src/main/AndroidManifest.xml
View file @
62e1fc5
...
...
@@ -16,7 +16,12 @@
android:label=
"@string/app_name"
android:supportsRtl=
"true"
android:theme=
"@style/AppTheme"
>
<activity
android:name=
".BootActivity"
/>
<activity
android:name=
".BootActivity"
>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
<activity
android:name=
".MainActivity"
android:label=
"@string/app_name"
...
...
@@ -27,10 +32,7 @@
</activity>
<activity
android:name=
".BaiduMapActivity"
>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
</application>
...
...
app/src/main/java/com/pashanhoo/landsurvey/search/TiandituSearch.java
0 → 100644
View file @
62e1fc5
package
com
.
pashanhoo
.
landsurvey
.
search
;
import
com.androidnetworking.AndroidNetworking
;
import
com.androidnetworking.error.ANError
;
import
com.androidnetworking.interfaces.JSONObjectRequestListener
;
import
org.json.JSONArray
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
java.util.ArrayList
;
public
class
TiandituSearch
{
private
static
ArrayList
<
POISuggestion
>
poiSuggestionArrayList
=
new
ArrayList
<
POISuggestion
>();
public
static
ArrayList
<
POISuggestion
>
getPoi
(
String
name
){
String
str
=
"{\"keyWord\":\""
+
name
+
"\",\"level\":\"11\",\"mapBound\":"
+
"\"76.24832,30.1129,156.40458,49.97618\",\"queryType\":\"1\",\"count\":\"10\""
+
",\"start\":\"0\",\"queryTerminal\":\"1000\"}"
;
AndroidNetworking
.
post
(
"http://map.tianditu.com/query.shtml"
)
.
addBodyParameter
(
"type"
,
"query"
)
.
addBodyParameter
(
"postStr"
,
str
)
.
setTag
(
"test"
)
.
build
()
.
getAsJSONObject
(
new
JSONObjectRequestListener
()
{
@Override
public
void
onResponse
(
JSONObject
response
)
{
try
{
JSONArray
jsonArray
=
response
.
getJSONArray
(
"pois"
);
for
(
int
i
=
0
;
i
<
jsonArray
.
length
();
i
++)
{
JSONObject
Jasonobject
=
jsonArray
.
getJSONObject
(
i
);
poiSuggestionArrayList
.
add
(
new
POISuggestion
(
Jasonobject
.
getString
(
"name"
),
Jasonobject
.
getString
(
"address"
),
Jasonobject
.
getString
(
"lonlat"
)));
}
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
}
@Override
public
void
onError
(
ANError
anError
)
{
poiSuggestionArrayList
=
null
;
}
});
return
poiSuggestionArrayList
;
}
}
Please
register
or
sign in
to post a comment