gpt4 book ai didi

java - 解析来自互联网的 xml 数据

转载 作者:行者123 更新时间:2023-12-01 15:07:42 24 4
gpt4 key购买 nike

大家好,我开发了一个简单的应用程序,它使用 SAX 从互联网读取 XML 文件,但我在 logcat 上收到此错误,任何帮助都可能有帮助

list 文件

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.reaf.xml"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.read.xml.DataHandler"
android:label="@string/title_activity_main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".MainActivity" >
</activity>
</application>

Logcat

10-06 07:38:00.014: D/dalvikvm(543): newInstance failed: no <init>()
10-06 07:38:00.054: D/AndroidRuntime(543): Shutting down VM
10-06 07:38:00.054: W/dalvikvm(543): threadid=1: thread exiting with uncaught exception (group=0x40015560)
10-06 07:38:00.064: E/AndroidRuntime(543): FATAL EXCEPTION: main
10-06 07:38:00.064: E/AndroidRuntime(543): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.reaf.xml/com.read.xml.DataHandler}: java.lang.InstantiationException: com.read.xml.DataHandler
10-06 07:38:00.064: E/AndroidRuntime(543): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1569)
10-06 07:38:00.064: E/AndroidRuntime(543): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
10-06 07:38:00.064: E/AndroidRuntime(543): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
10-06 07:38:00.064: E/AndroidRuntime(543): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
10-06 07:38:00.064: E/AndroidRuntime(543): at android.os.Handler.dispatchMessage(Handler.java:99)
10-06 07:38:00.064: E/AndroidRuntime(543): at android.os.Looper.loop(Looper.java:123)
10-06 07:38:00.064: E/AndroidRuntime(543): at android.app.ActivityThread.main(ActivityThread.java:3683)
10-06 07:38:00.064: E/AndroidRuntime(543): at java.lang.reflect.Method.invokeNative(Native Method)
10-06 07:38:00.064: E/AndroidRuntime(543): at java.lang.reflect.Method.invoke(Method.java:507)
10-06 07:38:00.064: E/AndroidRuntime(543): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
10-06 07:38:00.064: E/AndroidRuntime(543): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
10-06 07:38:00.064: E/AndroidRuntime(543): at dalvik.system.NativeStart.main(Native Method)
10-06 07:38:00.064: E/AndroidRuntime(543): Caused by: java.lang.InstantiationException: com.read.xml.DataHandler
10-06 07:38:00.064: E/AndroidRuntime(543): at java.lang.Class.newInstanceImpl(Native Method)
10-06 07:38:00.064: E/AndroidRuntime(543): at java.lang.Class.newInstance(Class.java:1409)
10-06 07:38:00.064: E/AndroidRuntime(543): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
10-06 07:38:00.064: E/AndroidRuntime(543): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1561)
10-06 07:38:00.064: E/AndroidRuntime(543): ... 11 more

我不知道错误是什么

请帮忙

最佳答案

您的包是com.reaf.xml,您的 Activity 名称是com.read.xml.DataHandler(您的包名称有误)。

请通过将包设置为com.read.xml并将 Activity 名称设置为.DataHandler来符合它们。

关于java - 解析来自互联网的 xml 数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12757873/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com