2015-04-23 43 views
-2

我创建了Fragment.A的布局,第一次创建它时没有问题,但是当我做出一些更改时,应用程序崩溃时打开它。 非常奇怪的是,即使当我放弃更改,并且xml代码与我创建的第一个完全相同时,应用程序在碎片打开时会崩溃!所以我不明白是什么问题,是否有可能是一个Eclipse的错误?加载xml布局时应用程序崩溃

这是我的代码:

<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> 

的logcat:

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 
+0

任何堆栈跟踪? –

+0

请发布您的logcat – Willis

+0

@PiotrGolinski我尝试启动我的应用程序int eclipse模拟器,但它给我和错误,因为缺少表,但如果我在设备上运行我的应用程序它的作品,所以我不能发布logcat因为该应用程序无法在模拟器上启动,我发布我的logcat以向您展示 – Slaiv206

回答

0

我不知道,它可以是重要的,尽量采取检查(互联网上也是如此)工作代码和检查丢失了一切。看起来像:tools:context =“.MainActivity或其他类似的东西。”

其他检查您是否在yor代码(或在您的控制中)的引用没有找到。

我不知道我是否可以帮你,

不错的工作!

相关问题