2012-02-29 75 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