I understand that activity uses Bundle, not int, to transfer fragment values.
(String value and image value go over and you have to pass it over. )
Please explain in more detail.
First, explain the sauce.
StartActivityForResult() for SecondActivity in MainActivity.
I'd like to send the result value back to Fragment.
(Fragment is the space to sprinkle a listview consisting of view pay on the MainActivity.)
android fragment onactivityresult
Fragments within an activity are managed through Fragment Manager. Therefore, to access fragments from the activity, use the findFragmentById(intid)
and findFragmentByTag(Stringtag)
functions in FragmentManager.
The former is a function that is accessed through the android:id set in View, and the latter is accessed through the tag (unique string) set as the second parameter at FragmentTransaction.add(Fragment, String)
.
For related information, refer to activity and communication in the document below. (Reading the document in general as well as that section will help you deal with the fragments.)
The following is an example of the use of the findFragmentById(intid)
function, as shown in the above document.
ExampleFragment fragment = (ExampleFragment) getFragmentManager().findFragmentById(R.id.example_fragment);
582 PHP ssh2_scp_send fails to send files as intended
613 GDB gets version error when attempting to debug with the Presense SDK (IDE)
573 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
916 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
© 2024 OneMinuteCode. All rights reserved.