Class Info |
|---|
public class SearchIntent widget提供的SearchIntent类,用于拉起地点搜索建议组件。 |
Qualifier and Type |
Field and Description |
|---|---|
static final int |
SEARCH_REQUEST_CODE 搜索请求码,值为1。 |
Qualifier and Type |
Method Name and Description |
|---|---|
Intent |
getIntent(Activity mainActivity) 获取跳转到搜索组件所在页面的Intent。 |
getSiteFromIntent(Intent data) 从Intent里获取Site对象。 |
|
getStatusFromIntent(Intent data) 从Intent里获取错误信息SearchStatus对象。 |
|
static boolean |
isSuccess(int resultCode) 检查resultCode是否是成功。 |
void |
setApiKey(String apiKey) 设置SearchIntent的API密钥,必选。 |
void |
setHint(String hint) 设置搜索框的默认文本。 |
void |
setSearchFilter(SearchFilter filter) 设置搜索的限制条件。 |
Method |
|---|
public Intent getIntent(Activity mainActivity) 获取跳转到搜索组件所在页面的Intent。 |
Parameters
Name |
Description |
|---|---|
mainActivity |
应用程序组件。 |
Returns
Type |
Description |
|---|---|
Intent |
调用搜索组件页面的Intent。 |
Parameters
Name |
Description |
|---|---|
data |
Intent。 |
Returns
Type |
Description |
|---|---|
Site |
被选中的Site对象。 |
Throws
Name |
Description |
|---|---|
NullPointerException |
如果data是null,抛出异常。 |
IllegalArgumentException |
如果data实例中的Site对象是null,抛出异常。 |
Method |
|---|
public SearchStatus getStatusFromIntent(Intent data) 从Intent里获取错误信息SearchStatus对象。 |
Parameters
Name |
Description |
|---|---|
data |
Intent。 |
Returns
Type |
Description |
|---|---|
错误信息对象。 |
Throws
Name |
Description |
|---|---|
NullPointerException |
如果data是null,抛出异常。 |
IllegalArgumentException |
如果data实例中的SearchStatus对象是null,抛出异常。 |
Method |
|---|
public static boolean isSuccess(int resultCode) 检查resultCode是否是成功。 |
Parameters
Name |
Description |
|---|---|
resultCode |
返回码。 |
Returns
Type |
Description |
|---|---|
boolean |
如果resultCode=0,返回true;否则返回false。 |
Method |
|---|
public void setApiKey(String apiKey) 设置SearchIntent的API密钥,必选。 |
Parameters
Name |
Description |
|---|---|
apiKey |
设置API密钥。 |
Throws
Name |
Description |
|---|---|
IllegalArgumentException |
如果apiKey是null,抛出异常。 |
Method |
|---|
public void setHint(String hint) 您调用此API可以设置搜索框的默认文本。 |
Parameters
Name |
Description |
|---|---|
hint |
搜索框的默认文本。 |
Method |
|---|
public void setSearchFilter(SearchFilter filter) 您调用此API可以设置搜索的限制条件。 |
Parameters
Name |
Description |
|---|---|
filter |
SearchFilter对象,地点搜索的限制条件。 |
Throws
Name |
Description |
|---|---|
IllegalArgumentException |
如果filter是null,抛出异常。 |