Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/198.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何在不更新整个应用程序的情况下更新片段的内容_Android - Fatal编程技术网

Android 如何在不更新整个应用程序的情况下更新片段的内容

Android 如何在不更新整个应用程序的情况下更新片段的内容,android,Android,我正在为我的大学制作一个应用程序,作为一个小项目。我已经把布告栏的碎片包括在里面了。但我不知道如何在不更新整个应用程序的情况下更新公告栏的内容。 我想把布告板做成这样的碎片。简单地告诉我之后我会自己做的。或者你可以告诉我整个编码和过程。非常感谢您的帮助如果您想更改片段,请使用以下命令: Fragment newFragment = new ExampleFragment(); FragmentTransaction transaction = getSupportFragmentManager

我正在为我的大学制作一个应用程序,作为一个小项目。我已经把布告栏的碎片包括在里面了。但我不知道如何在不更新整个应用程序的情况下更新公告栏的内容。


我想把布告板做成这样的碎片。简单地告诉我之后我会自己做的。或者你可以告诉我整个编码和过程。非常感谢您的帮助

如果您想更改片段,请使用以下命令:

Fragment newFragment = new ExampleFragment();
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();

// Replace whatever is in the fragment_container view with this fragment,
transaction.replace(R.id.fragment_container, newFragment);
transaction.addToBackStack(null);

transaction.commit();

如果要更改片段,应使用以下命令:

Fragment newFragment = new ExampleFragment();
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();

// Replace whatever is in the fragment_container view with this fragment,
transaction.replace(R.id.fragment_container, newFragment);
transaction.addToBackStack(null);

transaction.commit();

不,我不想换碎片。我想更新它。不,我不想更改片段。我想更新它。我猜你想更新碎片上的数据。为什么不使用?不,这种方法在我的情况下不起作用。你什么时候需要更新片段的内容?我想在通知栏上有通知的时候更新内容。我想你是想更新片段上的数据。为什么不使用?不,这种方式在我的情况下不起作用。你什么时候需要更新片段的内容?我想在布告栏上有通知时更新内容。