2011-09-09 36 views
0

嗨IAM工作...出錯通知是應用程序已經被意外終止Android的問題在Android上發現了以下問題爲我登錄,但我沒有得到我的錯誤

我的代碼是

package layout.program; 

import android.app.Activity; 
import android.os.Bundle; 

public class Tablelayout extends Activity{ 
public void onCreate(Bundle savedInstanceState){ 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.tablelayout); 
} 
} 

tablelayout.xml

<?xml version="1.0" encoding="utf-8"?> 
<TableLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 
    <TableRow android:id="@+id/tableRow1" android:layout_width="wrap_content"   android:layout_height="wrap_content"> 
    <TextView android:layout_height="wrap_content" android:text="TextView"  android:id="@+id/textView1" android:textAppearance="?android:attr/textAppearanceMedium" android:layout_width="wrap_content"></TextView> 
    <EditText android:id="@+id/editText1" android:layout_height="wrap_content" android:layout_width="fill_parent"> 
     <requestFocus></requestFocus> 
    </EditText> 
</TableRow> 

</TableLayout> 

snapshot of logcat and emulator

+0

是什麼問題? – Parvesh

+0

它顯示錯誤:應用程序已意外終止 –

+0

檢查logcat並查看異常併發布.. – Parvesh

回答

1

嘗試清理你的項目.. 通過選擇該項目,然後去頂部項目選項,然後選擇清潔。 然後選擇OK ..

有時,改變也不會在R.java ......那是本機誤配

1

你的代碼工作正常,在我的最後..請檢查你的代碼,如果有什麼是造成異常..試着用調試器調試....

+0

我試過了,它的顯示像這樣Source not found :A:\ AndroidSDK \ android-sdk \ platforms \ android-8 \ android.jar沒有源碼附件 –

+0

清理項目或重啓eclipse ..... –

0

變化的類名,然後再試一次,還檢查活動名稱中提到的Android清單是正確的。

1

你的代碼或xml沒有問題,所以它必須是你的清單中的錯誤。 由於這個應用只是一個存根,爲什麼不這樣做:

  • 創建一個新的Android項目,叫它任何你喜歡的。

  • 呼叫活動 'TableLayoutActivity'

  • 把你tablelayout.xml到佈局文件夾。

  • 變化TablelayoutActivity.java自動生成的代碼以從的setContentView(R.layout.main)的setContentView(R.layout.tablelayout)中設置的內容視圖

這應該工作,然後查看新項目中的清單,以查看原始項目中出錯的位置。

相關問題