我正在尝试从包含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<stdio.h> <br/>
#include<conio.h> <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<stdio.h> <br/>
#include<conio.h> <br/>
尝试添加
;
符号,如下所示:#include<stdio.h> <br/>
#include<conio.h> <br/>
&
&
是一个特殊符号。 <
用于显示<
符号。
关于android - 从Android Studio中的素材资源文件夹加载html页面时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36338820/