我正在嘗試爲用戶創建一種方法,以便在手機上創建帳戶,該帳戶最終將通過應用程序同步到其聯繫人。我現在在模擬器上工作,所以我要去Menu-Dev Tools-AccountsTester來測試我有什麼。當我點擊AccountsTester,我得到的logcat下面的錯誤代碼:嘗試在Android中添加帳戶時獲得例外
03-08 18:58:31.996: ERROR/AndroidRuntime(403): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.development/com.android.development.AccountsTester}: android.content.res.Resources$NotFoundException: String resource ID #0x0
03-08 18:58:31.996: ERROR/AndroidRuntime(403): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1622)
03-08 18:58:31.996: ERROR/AndroidRuntime(403): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1638)
03-08 18:58:31.996: ERROR/AndroidRuntime(403): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
03-08 18:58:31.996: ERROR/AndroidRuntime(403): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:928)
03-08 18:58:31.996: ERROR/AndroidRuntime(403): at android.os.Handler.dispatchMessage(Handler.java:99)
03-08 18:58:31.996: ERROR/AndroidRuntime(403): at android.os.Looper.loop(Looper.java:123)
03-08 18:58:31.996: ERROR/AndroidRuntime(403): at android.app.ActivityThread.main(ActivityThread.java:3647)
03-08 18:58:31.996: ERROR/AndroidRuntime(403): at java.lang.reflect.Method.invokeNative(Native Method)
03-08 18:58:31.996: ERROR/AndroidRuntime(403): at java.lang.reflect.Method.invoke(Method.java:507)
03-08 18:58:31.996: ERROR/AndroidRuntime(403): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
03-08 18:58:31.996: ERROR/AndroidRuntime(403): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
03-08 18:58:31.996: ERROR/AndroidRuntime(403): at dalvik.system.NativeStart.main(Native Method)
03-08 18:58:31.996: ERROR/AndroidRuntime(403): Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x0
03-08 18:58:31.996: ERROR/AndroidRuntime(403): at android.content.res.Resources.getText(Resources.java:201)
03-08 18:58:31.996: ERROR/AndroidRuntime(403): at android.content.res.Resources.getString(Resources.java:254)
03-08 18:58:31.996: ERROR/AndroidRuntime(403): at android.content.Context.getString(Context.java:183)
03-08 18:58:31.996: ERROR/AndroidRuntime(403): at com.android.development.AccountsTester.initializeAuthenticatorsSpinner(AccountsTester.java:147)
03-08 18:58:31.996: ERROR/AndroidRuntime(403): at com.android.development.AccountsTester.onCreate(AccountsTester.java:63)
03-08 18:58:31.996: ERROR/AndroidRuntime(403): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
03-08 18:58:31.996: ERROR/AndroidRuntime(403): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1586)
03-08 18:58:31.996: ERROR/AndroidRuntime(403): ... 11 more
正如你可以看到有表示將錯誤在我的代碼不發生@行。我谷歌搜索了一些突出的線條,但找不到與我的問題有關的任何內容。有沒有人知道這裏發生了什麼?請讓我知道是否有任何信息可以用來幫助回答我沒有包括的內容......謝謝!
這AccountsTester會調用佈局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ScrollView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:paddingTop="5dip"
android:paddingLeft="20dip"
android:paddingRight="20dip"
android:paddingBottom="13dip">
<TextView android:id="@+id/account_login_message"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dip"/>
<TextView
android:textAppearance="?android:attr/textAppearanceSmall"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Username"/>
<EditText android:id="@+id/account_login_username_edittext"
android:singleLine="true"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:minWidth="250dip"
android:scrollHorizontally="true"
android:capitalize="none"
android:autoText="false"
android:inputType="text"/>
<TextView android:id="@+id/account_login_username_fixed"
android:textAppearance="?android:attr/textAppearanceSmall"
android:singleLine="true"
android:layout_marginTop="2dip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:textAppearance="?android:attr/textAppearanceSmall"
android:textStyle="bold"
android:singleLine="true"
android:layout_marginTop="2dip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Password"/>
<EditText android:id="@+id/account_login_password_edittext"
android:singleLine="true"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:minWidth="250dip"
android:scrollHorizontally="true"
android:capitalize="none"
android:autoText="false"
android:inputType="textPassword"/>
<TextView android:id="@+id/account_login_message_bottom"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dip"/>
</LinearLayout>
</ScrollView>
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#c6c3c6"
android:minHeight="54dip"
android:paddingLeft="2dip"
android:paddingTop="4dip"
android:paddingRight="2dip">
<Button android:id="@+id/account_login_ok_button"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="center_horizontal"
android:minWidth="100dip"
android:text="Sign In"
android:onClick="handleLogin"/>
</FrameLayout>
</LinearLayout>
我不叫一個字符串有...我的活動引用串的幾次,但它的字符串引用最肯定是有的,我當我輸入時看到它們,並且我會在Eclipse中得到一個錯誤。
你可以張貼的佈局爲您的活動? – 2011-03-09 03:18:27
添加它,感謝您的幫助 – JMRboosties 2011-03-09 03:45:55