Combination of androidactivity and WebView

Source: Internet
Author: User


<?xml version= "1.0" encoding= "Utf-8"?>
<linearlayout xmlns:android= "Http://schemas.android.com/apk/res/android"
Xmlns:tools= "Http://schemas.android.com/tools"
Android:id= "@+id/container"
Android:layout_width= "Match_parent"
android:layout_height= "Match_parent"
android:orientation= "Vertical" >

<!--Header Page--

<linearlayout
Android:id= "@+id/mian_header"
Android:layout_width= "Match_parent"
android:layout_height= "90dip"
android:background= "@color/main_header_bg_new"
android:orientation= "Vertical"/>
<!--Body Page--

<linearlayout
Android:id= "@+id/mian_body"
Android:layout_width= "Match_parent"
android:layout_height= "0dip"
android:layout_weight= "1"
android:background= "@color/main_body_bg_new"
android:orientation= "Vertical"/>

</LinearLayout>

Activity and WebView

1. First define a UI activity (containing the WebView region).
2.UI activity Java code to define the WebView area of the replacement code, replace the template code with WebView (similar to the addition of the Div, the div container itself does not have the content, just the role of the position), to achieve the fallback function (not shown, ugly AH).
Fragmenttransaction ft = manager.begintransaction ();
Xxxxx
Xxxxx
Xxxxx
Ft.commit (do not forget the commit, whether the person has no effect);
3. Perform related operations in WebView (this is extended separately, not in detail).
4. In the other display section of the UI, click the blank fallback function or click the home fallback feature.
5. Beware of unusual captures, handling, and friendly hints.


String Carnumber = arraydata[0].substring (Arraydata[0].lastindexof (",") + 1). Trim ();
Fragmenttransaction ft = manager.begintransaction ();
Ft.replace (R.id.mian_body, Webfragment, "webviewfragment");
Bundle bundle = new bundle ();
Bundle.putstring (Ovalconstant.tag_model_key, Ovalconstant.tag_customer_value);
Bundle.putstring (Ovalconstant.shared_plateno_zh_key, Bodysearchtextview.gettext (). toString ());
if (" -999". Equals (Arraydata[3].trim ())) {
Bundle.putstring (Ovalconstant.tag_params_key, "plateno=" + carnumber);
} else {
Bundle.putstring (Ovalconstant.tag_params_key, "plateno=" + carnumber + "&customercode=" + ArrayData[3].trim ());//

Combination of androidactivity and WebView

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.