小编ton*_*nny的帖子

Android Fragment getArguments()返回null

正如标题所示.
Fragment从这里下载了代码,http://developer.android.com/shareables/training/FragmentBasics.zip.
这是来自Android官方开发者网站的片段示例.http://developer.android.com/training/basics/fragments/fragment-ui.html

这是MainActivity.java's onCreate():

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.news_articles);

    // Check whether the activity is using the layout version with
    // the fragment_container FrameLayout. If so, we must add the first fragment
    if (findViewById(R.id.fragment_container) != null) {

        // However, if we're being restored from a previous state,
        // then we don't need to do anything and should …
Run Code Online (Sandbox Code Playgroud)

android android-fragments

11
推荐指数
2
解决办法
5万
查看次数

标签 统计

android ×1

android-fragments ×1