2012-02-29 81 views
0

我試圖用這個代碼轉換活動:無法切換活動

 Intent i = new Intent(this, RegisterActivity.class); 
    startActivity(i); 

然後我得到了錯誤,說我需要將新類添加到清單,但我記得沒有改變清單做(在NetBeans現在我使用eclipse)。將類添加到清單後,我得到這個錯誤:

java.lang.RuntimeException: Unable to start activity ComponentInfo{ XXXX }: android.view.InflateException: Binary XML file line #63: Error inflating class <unknown> 

任何建議來解決異常?

的清單是:

<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
package="streetMeet.Client" 
android:versionCode="1" 
android:versionName="1.0" > 

<uses-sdk android:minSdkVersion="10" /> 

<application 
    android:icon="@drawable/ic_launcher" 
    android:label="@string/app_name" > 
    <activity android:name=".StreetMeetActivity" android:label="@string/app_name"> 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 

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


</application> 

主要活動的佈局是:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:orientation="vertical" > 

<TextView 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="@string/hello" /> 

+4

你能顯示你的清單和你的活動佈局嗎? – 2012-02-29 18:34:35

+0

佈局非常基本 – Rami 2012-02-29 18:45:03

+1

我們需要看到佈局,不管其基本原理如何。 – 2012-02-29 18:48:14

回答

1

正如你們指出我的問題是在XML佈局。無論我添加「。」都沒有關係。或不。

謝謝

2

你在你的清單忘了前面的.Activity名。它應該是...

android:name=".RegisterActivity" 
+0

哇很好的現貨! – 2012-02-29 18:49:05

+0

沒有改變例外 – Rami 2012-02-29 19:12:44

+1

我不確定它是否有效,但如果沒有這種改變,事情肯定無法奏效。您現在需要確定哪一個XML文件在第63行有一個錯誤...'InflateException:二進制XML文件行#63' – Squonk 2012-02-29 19:29:41