我正在通過Android教程學習我的方式。我在new activity課上遇到問題。如果我允許應用程序調用PlaceholderFragment
(我不知道它是什麼),該應用程序崩潰。如果我不能按預期工作。這是PlaceholderFragment
部通過蝕默認eclips的Android新活動崩潰
public static class PlaceholderFragment extends Fragment {
public PlaceholderFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_display_message,
container, false);
return rootView;
}
}
作爲生成的I使用eclipse編譯代碼,和Nexus 7設備(最新版本)上運行它。 Android的最低版本是2.2.3,而最新版本是最新版本。
這是我做的嗎?與我的設備有什麼關係?什麼與我的日食設置?
編輯
03-29 20:41:57.934: E/AndroidRuntime(26725): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
03-29 20:41:57.934: E/AndroidRuntime(26725): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
03-29 20:41:57.934: E/AndroidRuntime(26725): at android.app.ActivityThread.access$800(ActivityThread.java:135)
03-29 20:41:57.934: E/AndroidRuntime(26725): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
03-29 20:41:57.934: E/AndroidRuntime(26725): at android.os.Handler.dispatchMessage(Handler.java:102)
03-29 20:41:57.934: E/AndroidRuntime(26725): at android.os.Looper.loop(Looper.java:136)
03-29 20:41:57.934: E/AndroidRuntime(26725): at android.app.ActivityThread.main(ActivityThread.java:5017)
03-29 20:41:57.934: E/AndroidRuntime(26725): at java.lang.reflect.Method.invokeNative(Native Method)
03-29 20:41:57.934: E/AndroidRuntime(26725): at java.lang.reflect.Method.invoke(Method.java:515)
03-29 20:41:57.934: E/AndroidRuntime(26725): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
03-29 20:41:57.934: E/AndroidRuntime(26725): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
03-29 20:41:57.934: E/AndroidRuntime(26725): at dalvik.system.NativeStart.main(Native Method)
03-29 20:41:57.934: E/AndroidRuntime(26725): Caused by: java.lang.IllegalArgumentException: No view found for id 0x7f05003c (com.example.dungeonworlddruid:id/container) for fragment PlaceholderFragment{41fcb9d0 #0 id=0x7f05003c}
03-29 20:41:57.934: E/AndroidRuntime(26725): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:930)
03-29 20:41:57.934: E/AndroidRuntime(26725): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1115)
03-29 20:41:57.934: E/AndroidRuntime(26725): at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
03-29 20:41:57.934: E/AndroidRuntime(26725): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1478)
03-29 20:41:57.934: E/AndroidRuntime(26725): at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:570)
03-29 20:41:57.934: E/AndroidRuntime(26725): at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1171)
03-29 20:41:57.934: E/AndroidRuntime(26725): at android.app.Activity.performStart(Activity.java:5241)
03-29 20:41:57.934: E/AndroidRuntime(26725): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2168)
03-29 20:41:57.934: E/AndroidRuntime(26725): ... 11 more
03-29 20:41:59.275: I/Process(26725): Sending signal. PID: 26725 SIG: 9
@請複製並粘貼LogCat所說的內容 –
發佈堆棧跟蹤。我不想通過猜測和猜錯來發布答案 – Raghunandan
如果你對片段不感興趣,你可以擺脫所有與之相關的代碼。和這次崩潰散列沒有任何與日食設置 – Raghunandan