Java 代码为';我没有把书拿出来。我尽了最大的努力但没有成功,请帮助我
这是我的代码(MainActivity1.java) 这是MainActivity1的XMLJava 代码为';我没有把书拿出来。我尽了最大的努力但没有成功,请帮助我,java,android,xml,epub,epublib,Java,Android,Xml,Epub,Epublib,这是我的代码(MainActivity1.java) 这是MainActivity1的XML <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_par
<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:background="#ADD8E6"
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.folowreader.MainActivity1" >
<ListView
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/textView5"
android:layout_marginLeft="75dp"
android:layout_marginTop="25dp"
android:layout_toRightOf="@+id/textView5" >
</ListView>
</RelativeLayout>
这是ContentViewActivity的XML
<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.folowreader.ContentViewActivity" >
<WebView
android:id="@+id/webView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_alignParentRight = "true"
></WebView>
</RelativeLayout>
这是main2的XML
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#ADD8E6" >
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>
我试图通过添加路径加书名来更改书名,但什么也没发生。这本书没有展出。该代码旨在创建一个内容列表(目录),然后在webView内的单独活动中显示每一行的内容。请帮帮我,我需要帮助。
我需要知道如何使代码工作 我注意到的第一件事是:
if (tocReferences == null) {
return;
}
你确定吗
book.getTableOfContents().getTocReferences()
不是简单地返回空指针吗?为了测试,我插入了一行toast:'if(tocReferences==null){toast.makeText(MainActivity1.this,“它返回空”,toast.LENGTH_LONG.show();return;}'最后它没有显示任何内容,所以我猜它没有返回空指针
if (tocReferences == null) {
return;
}
book.getTableOfContents().getTocReferences()