Android 加载xml布局时应用程序崩溃
我已经创建了一个片段的布局。这是我第一次创建它时没有问题,但是当我做一些更改时,当我打开它时,应用程序崩溃了。 非常奇怪的是,即使我放弃了更改,并且xml代码与我创建的第一个代码完全相同,当片段打开时,应用程序也会崩溃!所以我不明白问题出在哪里,可能是Eclipse的bug吗 这是我的代码:Android 加载xml布局时应用程序崩溃,android,xml,Android,Xml,我已经创建了一个片段的布局。这是我第一次创建它时没有问题,但是当我做一些更改时,当我打开它时,应用程序崩溃了。 非常奇怪的是,即使我放弃了更改,并且xml代码与我创建的第一个代码完全相同,当片段打开时,应用程序也会崩溃!所以我不明白问题出在哪里,可能是Eclipse的bug吗 这是我的代码: <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/androi
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout" android:layout_width="match_parent"
android:layout_height="match_parent" tools:context="com.lp.lemiediete.MainActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView android:id="@+id/bmi_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#4285f4"
android:textSize="30dp"
android:text="Il tuo Bmi" />
<TextView android:id="@+id/bmi"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/bmi_text"
android:layout_centerHorizontal="true"
android:gravity="center|center_vertical"
android:textColor="#000000"
android:textSize="50dp"
android:text="" />
<TextView android:id="@+id/tipo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/bmi"
android:textColor="#000000"
android:layout_centerHorizontal="true"
android:gravity="center|center_vertical"
android:textSize="20dp"
android:text="" />
<TextView android:id="@+id/peso"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tipo"
android:textColor="#000000"
android:textSize="40dp" />
<TextView android:id="@+id/altezza"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tipo"
android:layout_alignParentRight="true"
android:textColor="#000000"
android:textSize="40dp" />
</RelativeLayout>
</android.support.v4.widget.DrawerLayout>
我不确定它是否重要,试着(在互联网上)检查一个工作代码,并检查是否遗漏了任何内容。Looklike:tools:context=“.MainActivity或其他类似内容。” 其他检查您是否在您的代码(或您的控件)中有运行时未找到的引用 我不知道我能不能帮你
干得好 请张贴您的logcat@PiotrGolinski我尝试在eclipse emulator中启动我的应用程序,但由于缺少一个表,它会给我和错误,但是如果我在设备上运行我的应用程序,它会工作,所以我不能发布logcat,因为应用程序没有在emulator上启动,我发布我的logcat以向您显示您当然可以从设备读取日志。单击ddms选项卡并选择您的真实设备。在有异常的地方显示代码。
没有这样的表:日期(代码1):,编译时:从日期选择数据
我不会调用我的表日期(日期会更好,原因有二)。需要查看您的CREATE TABLE
code。@DerGolem是的,但是我已经检查过了,这个表没有问题,如果有问题,这个应用程序在我的设备上就不能工作了
04-23 14:37:19.678: E/SQLiteLog(899): (1) no such table: date
04-23 14:37:19.693: D/AndroidRuntime(899): Shutting down VM
04-23 14:37:19.693: D/AndroidRuntime(899): --------- beginning of crash
04-23 14:37:19.735: E/AndroidRuntime(899): FATAL EXCEPTION: main
04-23 14:37:19.735: E/AndroidRuntime(899): Process: com.lp.lemiediete, PID: 899
04-23 14:37:19.735: E/AndroidRuntime(899): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.lp.lemiediete/com.lp.lemiediete.MainActivity}: android.database.sqlite.SQLiteException: no such table: date (code 1): , while compiling: SELECT data FROM date