SoFunction
Updated on 2025-03-11

Analysis of precautions about loadData method of Android WebView

Analysis of precautions about loadData method of Android WebView

Updated: June 19, 2013 10:59:16 Author:
This article provides a detailed analysis and introduction to the precautions for loadData method of WebView in Android. For those who need it, please refer to it.
The html data in loadData() cannot contain special characters in '#', '%', '\', '?'. If such characters appear, parsing errors will occur, and some html code will be displayed. What should be done? We need to encode it with UrlEncoder as %23, %25, %27, %3f.
You can use the following two codes, data is a string type html code
1、((data, "utf-8"), "text/html",  "utf-8");
Such background effects are not very good-looking. Not recommended.
2、(null,data, "text/html",  "utf-8", null);
This will make a perfect analysis.
  • Android
  • WebView
  • loadData method

Related Articles

  • Four ways to completely exit the current application with Android

    Android programs have many activities, such as main window A, which calls child window B. If you finish() directly in B, A will be displayed next. How to close the entire Android application in B? I have summarized several simple implementation methods
    2016-02-02
  • ImageView click on dimmable instance code (android code skills)

    This article will share with you an example code to introduce the example code that can be dimmed by ImageView. It is very good and has reference value. If you need it, please refer to it.
    2017-02-02
  • How to dynamically add components using addView

    This article mainly introduces in detail the method of dynamically adding components using addView on Android. It has certain reference value. Interested friends can refer to it.
    2016-09-09
  • Android Development Use WebUploader to solve bugs encountered in uploading pictures by Android WeChat browser

    This article mainly introduces Android development. Use WebUploader to solve bug problems encountered in uploading pictures in Android WeChat browser. This article introduces it in detail. Friends who need it can refer to it.
    2016-11-11
  • Analysis of Notification Usage of Introduction to Android Development

    This article mainly introduces the usage of Notification in Android, and analyzes the functions, usage steps and related precautions in more detail. Friends who need it can refer to it.
    2016-07-07
  • Android json data analysis detailed explanation and example code

    This article mainly introduces the detailed explanation of Android json data analysis and related information about the example code. Friends who need it can refer to it
    2017-02-02
  • Two ways to return thumbnails after taking photos on Android

    Hello everyone, this article mainly talks about two methods of returning thumbnails after taking photos on Android. Interested students, come and take a look. If it is helpful to you, remember to bookmark it.
    2022-01-01
  • Things to note when implementing custom controls with ListView with multiple check boxes and other states

    Android itself provides several convenient Adapters for ListView, such as ArrayAdapter, SimpleCurrentAdapter, etc. Next, we introduce the precautions for custom Adapter to implement the status controls such as ListView with multiple check boxes. Interested friends can learn more about it, which may be helpful to you.
    2013-01-01
  • Android implements node progress bar effect

    This article mainly introduces the effect of Android node progress bar implementation in detail. The sample code in the article is introduced in detail and has certain reference value. Interested friends can refer to it.
    2018-05-05
  • Android Studio implements simple calculator source code

    This article mainly introduces the source code of Android Studio implementation simple calculator. The sample code in the article is introduced in detail and has a certain reference value. Interested friends can refer to it.
    2022-05-05

Latest Comments