2015-04-23 45 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代碼(或在您的控制中)的引用沒有找到。

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

不錯的工作!

相關問題