android - 从Android Studio中的素材资源文件夹加载html页面时出错

标签 android html webview compiler-errors android-assets

我正在尝试从包含C编程代码的 Assets 文件夹中加载html,但出现类似错误

Error:(7, 19) Error: The reference to entity "ltstdio.h" must end with the ';' delimiter.



在android studio中

P_Armstrong_number.java
    import android.support.v7.app.AppCompatActivity;
    import android.os.Bundle;
    import android.webkit.WebView;

    public class P_Armstrong_number extends AppCompatActivity {

         WebView wv;
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_p__armstrong_number);

            wv=(WebView)findViewById(R.id.wv_amstrong_number);
            wv.loadUrl("file:///android_asset/arm_series.html");


        }
    }

activity_p_armstrong_number.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.example.MyfirstApp.P_Armstrong_number"
    android:id="@+id/wv_amstrong_number">

    <WebView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/webView"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentEnd="true" />
</RelativeLayout>

arm_series.html
<html>
      <head>
      </head>
      <body>
       <h4>Armstrong series:<br/></h4>
    <p>
    #include&ltstdio.h&gt <br/>
    #include&ltconio.h&gt <br/>
    #include<math.h> <br/>
    main()<br/>
    {<br/>
        int n,m;<br/>
        printf("Enter from where to start:\n");<br/>
        scanf("%d",&n);<br/>
        printf("Enter where to end:\n");<br/>
        scanf("%d",&m);<br/>
        int num=0;<br/>

        int i=n;<br/>
        while(i<=m)<br/>
        {<br/>
            num=num+i;<br/>
            int sum=0;<br/>
            while(num!=0)<br/>
        {<br/>
                int rm=num%10;<br/>
                sum=sum+(rm*rm*rm);<br/>
                num=num/10;<br/>
            }<br/>
            if(sum==i)<br/>
            printf("%d ",sum);<br/>
            i++;<br/>
        }<br/>
        getch();<br/>
    }<br/>
    </p>
    <p>
    <h4>Output:</h4>Enter from where to start:<br/>
    1<br/>Enter where to end:<br/>500<br/>1 153 370 371 407
    </p>
        </body>
    </html>

我对此感到困惑,请从此错误中帮助我

最佳答案

以下字符串中的问题:

#include&ltstdio.h&gt <br/>
#include&ltconio.h&gt <br/>

尝试添加;符号,如下所示:
#include&lt;stdio.h&gt; <br/>
#include&lt;conio.h&gt; <br/>

&是一个特殊符号。 &lt;用于显示<符号。

关于android - 从Android Studio中的素材资源文件夹加载html页面时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36338820/

相关文章:

android - 在webview中获取支付网关的回调

android - 通过 Intent 在类之间发送一个变量

android - JPA、EclipseLink 和 Android

javascript - 提交表单后保留下拉值

html - Bootstrap NavBar 没有按预期折叠 - 分成两行

android - 如何在 Android 上非常大的 WebView 下设置按钮?

Android Load Cache Only 不工作。离线显示 WebView

java - 如何将解析后的 XML 显示到 ListView

java - Eclipse 无法将我的类(class)识别为 fragment

html - 我可以创建一个带有 flex 底部的div吗?