Android SDK API reference for the HTML5 container and offline packages in the 10.1.60 baseline.
Public functions
H5TitleView
getTitle
-
Declaration:
String getTitle(); -
Description: Retrieves the main title text.
-
Parameters: None.
-
Return value: The main title.
setTitle
-
Declaration:
void setTitle(String title); -
Description: Sets the main title text.
-
Parameters:
Parameter
Type
Description
title
String
The title text.
-
Return value: None.
setSubTitle
-
Declaration:
void setSubTitle(String subTitle); -
Description: Sets the subtitle.
-
Parameters:
Parameter
Type
Description
subTitle
String
The subtitle text.
-
Return value: None.
setImgTitle
-
Declaration:
void setImgTitle(Bitmap imgTitle); -
Description: Sets the image icon.
-
Parameters:
Parameter
Type
Description
imgTitle
Bitmap
The image information.
-
Return value: None.
setImgTitle
-
Declaration:
void setImgTitle(Bitmap imgTitle,String contentDescription); -
Description: Sets the image icon and contentDescription.
-
Parameters:
Parameter
Type
Description
imgTitle
Bitmap
The image information.
contentDescription
String
The content of contentDescription.
-
Return value: None.
showCloseButton
-
Declaration:
void showCloseButton(boolean visible); -
Description: Specifies whether to show the Close button.
-
Parameters:
Parameter
Type
Description
visible
boolean
If set to true, the Close button is shown.
If set to false, the Close button is not shown.
-
Return value: None.
getContentView
-
Declaration:
View getContentView(); -
Description: Retrieves the title bar View.
-
Parameters: None.
-
Return value: The title bar View.
getContentBgView
-
Declaration:
ColorDrawable getContentBgView(); -
Description: Retrieves the title bar background.
-
Parameters: None.
-
Returns the ColorDrawable object for the title bar background.
getMainTitleView
-
Declaration:
TextView getMainTitleView(); -
Description: Retrieves the main title View.
-
Parameters: None.
-
Returns the TextView for the main title.
getSubTitleView
-
Declaration:
TextView getSubTitleView(); -
Description: Retrieves the subtitle View.
-
Parameters: None.
-
Return value: The TextView for the subtitle.
showBackButton
-
Declaration:
void showBackButton(boolean visible); -
Description: Specifies whether to show the back button.
-
Parameters:
Parameter
Type
Description
visible
boolean
If set to true, the back button is shown.
If set to false, the back button is not shown.
-
Return value: None.
showBackHome
-
Declaration:
void showBackHome(boolean visible); -
Description: Sets the home button visibility.
-
Parameters:
Parameter
Type
Description
visible
boolean
If set to true, the back button is displayed.
If set to false, the back button is not displayed.
-
Return value: None.
showOptionMenu
-
Declaration:
void showOptionMenu(boolean visible); -
Description: Specifies whether to show the menu item in the upper-right corner.
-
Parameters:
Parameter
Type
Description
visible
boolean
If set to true, the menu is shown.
If set to false, the menu is not shown.
-
Return value: None.
setOptionType
-
Declaration:
void setOptionType(H5Param.OptionType type); -
Description: Sets the display type of the menu item in the upper-right corner.
-
Parameters:
Parameter
Type
Description
type
H5Param.OptionType
The menu display type.
-
Return value: None.
setOptionType
-
Declaration:
void setOptionType(H5Param.OptionType type, int num, boolean byIndex); -
Description: Sets the display type of the menu item in the upper-right corner.
-
Parameters:
Parameter
Type
Description
type
H5Param.OptionType
The menu display type.
num
int
The index of the icon, counted from right to left, starting from 0.
byIndex
boolean
Specifies whether to set the display type for only a specific menu item.
-
Return value: None.
showTitleLoading
-
Declaration:
void showTitleLoading(boolean visible); -
Description: Shows or hides the loading status on the title bar. The loading indicator can be customized.
-
Parameters:
Parameter
Type
Description
visible
boolean
Specifies whether to show the loading status on the title bar.
-
Return value: None.
setBtIcon
-
Declaration:
void setBtIcon(Bitmap btIcon, int index); -
Description: Sets the icon for the button in the upper-right corner.
-
Parameters:
Parameter
Type
Description
btIcon
Bitmap
The icon.
index
int
The index of the icon, counted from right to left, starting from 0.
-
Return value: None.
setH5Page
-
Declaration:
void setH5Page(H5Page h5Page); -
Description: Sets the HTML5 page for the container.
-
Parameters:
Parameter
Type
Description
h5Page
H5Page
The HTML5 page.
-
Return value: None.
setOptionMenu
-
Declaration:
void setOptionMenu(JSONObject params); -
Description: Sets the menu in the upper-right corner based on parameters passed from JavaScript.
-
Parameters:
Parameter
Type
Description
params
JSONObject
The JS parameters.
-
Return value: None.
getDivider
-
Declaration:
View getDivider(); -
Description: Retrieves the line separator between the back button and the title content. May return null.
-
Parameters: None.
-
Return value: The line separator View.
getHdividerInTitle
-
Declaration:
View getHdividerInTitle(); -
Description: Retrieves the line separator between the title bar and the web page. Never returns null.
-
Parameters: None.
-
Return value: The View for the line separator.
getPopAnchor
-
Declaration:
View getPopAnchor(); -
Description: Retrieves the anchor View for the pop-up position of the drop-down menu.
-
Parameters: None.
-
Return value: The anchor View for the pop-up position of the drop-down menu.
resetTitleColor
-
Declaration:
void resetTitleColor(int color); -
Description: Resets the background color of the title bar.
-
Parameters:
Parameter
Type
Description
color
int
The color value.
-
Return value: None.
releaseViewList
-
Declaration:
void releaseViewList(); -
Description: Releases the referenced View. Called when the container page is destroyed.
-
Parameters: None.
-
Return value: None.
openTranslucentStatusBarSupport
-
Declaration:
void openTranslucentStatusBarSupport(int color); -
Description: Sets the color for the immersive title bar.
-
Parameters:
Parameter
Type
Description
color
int
The color value.
-
Return value: None.
setTitleTxtColor
-
Declaration:
void setTitleTxtColor(int color); -
Description: Sets the font color of the title bar.
-
Parameters:
Parameter
Type
Description
color
int
The color value.
-
Return value: None.
getOptionMenuContainer
-
Declaration:
View getOptionMenuContainer(); -
Description: Retrieves the menu View in the upper-right corner. The returned View must be a `ViewGroup` or a subclass.
-
Parameters: None.
-
Return value: The menu View in the upper-right corner.
getOptionMenuContainer
-
Declaration:
View getOptionMenuContainer(int index); -
Description: Retrieves the menu View in the upper-right corner based on its position. The returned View must be a `ViewGroup` or a subclass.
-
Parameters:
Parameter
Type
Description
index
int
The position of the icon, counted from right to left, starting from 0.
-
Return value: The menu View in the upper-right corner.
setBackgroundAlphaValue
-
Declaration:
void setBackgroundAlphaValue(int alpha); -
Description: Sets the background transparency.
-
Parameters:
Parameter
Type
Description
alpha
int
The transparency value.
-
Return value: None.
setBackgroundColor
-
Declaration:
void setBackgroundColor(int color); -
Description: Sets the background color.
-
Parameters:
Parameter
Type
Description
color
int
The background color value.
-
Return value: None.
H5AppCenterPresetProvider
getCommonResourceAppList
-
Declaration:
Set<String> getCommonResourceAppList(); -
Description: Retrieves the global resource plans.
-
Parameters: None.
-
Returns a
Set<String>that is a collection of global resource plans.
getH5PresetPkg
-
Declaration:
H5PresetPkg getH5PresetPkg(); -
Description: Retrieves the preset resource plan.
-
Parameters: None.
-
Return value: H5PresetPkg. An HTML5 preset resource plan.
getTinyCommonApp
-
Declaration:
String getTinyCommonApp(); -
Description: Retrieves the app ID of the public resource plan for the tiny app.
-
Parameters: None.
-
Return value: The app ID of the public resource plan for the tiny app.
H5Plugin
onPrepare
-
Declaration:
void onPrepare(H5EventFilter filter); -
Description: Registers an HTML5 plugin filter during the preparation phase.
-
Parameters:
Parameter
Type
Description
filter
H5EventFilter
The HTML5 plugin filter.
-
Return value: None.
interceptEvent
-
Declaration:
boolean interceptEvent(final H5Event event, final H5BridgeContext context); -
Description: Intercepts an event.
-
Parameters:
Parameter
Type
Description
event
H5Event
The HTML5 event.
context
H5BridgeContext
The context.
-
Return value: `true` if the event is successfully intercepted, or `false` otherwise.
handleEvent
-
Declaration:
boolean handleEvent(final H5Event event, final H5BridgeContext context); -
Note: This parameter determines whether to send events.
-
Parameters:
Parameter
Type
Description
event
H5Event
A read-only event that can be handled.
context
H5BridgeContext
The bridge context used to handle JavaScript API-related events.
-
Return value: boolean. `true` indicates that the plugin has handled the event. `false` indicates otherwise.
H5ReplaceResourceProvider
Dynamic loading pointcut for custom resources
getReplaceResourcesBundleName
-
Declaration:
String getReplaceResourcesBundleName(); -
Description: Retrieves the bundle name of the title bar resource.
-
Parameters: None.
-
Return value: The bundle name of the title bar resource.
H5ErrorPageView
An interface for custom network error pages.
enableShowErrorPage
-
Declaration:
boolean enableShowErrorPage(H5Page h5Page, APWebView view, String errorUrl, int statusCode, String errorMsg, String subErrorMsg, Bundle extInfo, Object extObj); -
Description: Specifies whether to show a custom error page.
-
Parameters:
Parameter
Type
Description
h5Page
H5Page
The Page object.
view
APWebView
The WebView object.
errorUrl
String
Faulting address
statusCode
int
The error code.
errorMsg
String
The error description.
subErrorMsg
String
The sub error description.
extInfo
Bundle
The extension information.
extObj
Object
The extension class.
-
Return value: A boolean value. If `true`, a custom page is shown and the errorPageCallback method is executed.
H5BridgeContext
An interface that allows HTML5 plugins to return results for JavaScript API requests.
sendBridgeResult
-
Declaration:
boolean sendBridgeResult(JSONObject data); -
Description: Returns a result to the JS layer. The event is consumed after each return. To use a BridgeContext for multiple returns, you must call the sendBridgeResultWithCallbackKept method.
-
Parameters:
Parameter
Type
Description
data
JSONObject
The data to return to the JS layer.
-
Return value: `true` on success, or `false` otherwise.
sendToWeb
-
Declaration:
void sendToWeb(String action, JSONObject param, H5CallBack callback); -
Description: Returns a result to the JS layer and supports callback parameters.
-
Parameters:
Parameter
Type
Description
action
String
The action for data transmission.
param
JSONObject
The data to pass to the JS layer.
callback
H5CallBack
-
-
Return value: None.
sendError
-
Declaration:
boolean sendError(H5Event event, Error code); -
Description: Sends an error message.
-
Parameters:
Parameter
Type
Description
event
H5Event
The HTML5 event.
code
Error
The error message.
-
Return value: boolean. `true` indicates that the message was sent successfully. `false` indicates otherwise.
sendSuccess
-
Declaration:
void sendSuccess(); -
Description: Handles HTML5 callbacks that have no return value.
-
Parameters: None.
-
Return value: None.
sendError
-
Declaration:
void sendError(int error, String errorMessage); -
Description: Customizes the returned error code and error message.
-
Parameters:
Parameter
Type
Description
error
int
The returned error code.
errorMessage
String
The returned message.
-
Return value: None.
Callback functions
errorPageCallback
-
Declaration:
void errorPageCallback(H5Page h5Page, APWebView view, String errorUrl, int statusCode, String errorMsg, String subErrorMsg, Bundle extInfo, Object extObj) -
Description: The error page callback.
-
Parameters:
Parameter
Type
Description
h5Page
H5Page
The Page object.
view
APWebView
The WebView object.
errorUrl
String
Invalid Address
statusCode
int
The error code.
errorMsg
String
The error description.
subErrorMsg
String
Fault description
extInfo
Bundle
The extension information.
extObj
Object
The extension class.
-
Return value: None.