Class Info |
|---|
public class SearchIntent SearchIntent class provided by the widget, which is used to start the search suggestion widget. |
Qualifier and Type |
Field and Description |
|---|---|
static final int |
SEARCH_REQUEST_CODE Search request code. The value is 1. |
Qualifier and Type |
Method Name and Description |
|---|---|
Intent |
getIntent(Activity mainActivity) Obtains an intent for redirecting to the page where the search widget is located. |
getSiteFromIntent(Intent data) Obtains a Site object from an intent. |
|
getStatusFromIntent(Intent data) Obtains a SearchStatus (result information) object from an intent. |
|
static boolean |
isSuccess(int resultCode) Checks resultCode to determine whether the search is successful. |
void |
setApiKey(String apiKey) (Mandatory) Sets the API key of SearchIntent. |
void |
setHint(String hint) Sets the default text in the search box. |
void |
setSearchFilter(SearchFilter filter) Sets search criteria. |
Method |
|---|
public Intent getIntent(Activity mainActivity) Obtains an intent for redirecting to the page where the search widget is located. |
Parameters
Name |
Description |
|---|---|
mainActivity |
App component. |
Returns
Type |
Description |
|---|---|
Intent |
Intent for redirecting to the page where the search widget is located. |
Parameters
Name |
Description |
|---|---|
data |
Intent. |
Returns
Type |
Description |
|---|---|
Site |
Selected Site object. |
Throws
Name |
Description |
|---|---|
NullPointerException |
If data is null. |
IllegalArgumentException |
If the Site object in the data instance is null. |
Method |
|---|
public SearchStatus getStatusFromIntent(Intent data) Obtains a SearchStatus (error information) object from an intent. |
Parameters
Name |
Description |
|---|---|
data |
Intent. |
Returns
Type |
Description |
|---|---|
Error information object. |
Throws
Name |
Description |
|---|---|
NullPointerException |
If data is null. |
IllegalArgumentException |
If the SearchStatus object in the data instance is null. |
Method |
|---|
public static boolean isSuccess(int resultCode) Checks resultCode to determine whether the search is successful. |
Parameters
Name |
Description |
|---|---|
resultCode |
Result code. |
Returns
Type |
Description |
|---|---|
boolean |
true if the value of resultCode is 0; false otherwise. |
Method |
|---|
public void setApiKey(String apiKey) (Mandatory) Sets the API key of SearchIntent. |
Parameters
Name |
Description |
|---|---|
apiKey |
API key. |
Throws
Name |
Description |
|---|---|
IllegalArgumentException |
If apiKey is null. |
Method |
|---|
public void setHint(String hint) Sets the default text in the search box. |
Parameters
Name |
Description |
|---|---|
hint |
Default text in the search box. |
Method |
|---|
public void setSearchFilter(SearchFilter filter) Sets search criteria. |
Parameters
Name |
Description |
|---|---|
filter |
SearchFilter object containing the search criteria. |
Throws
Name |
Description |
|---|---|
IllegalArgumentException |
If filter is null. |