SOURCE CODE REFERENCE :

In the previous class we saw how to pass data from one activity to another.Today lets see how to pass data from an activity to a fragment via Bundle object. We are passing data from a spinner and edittext on a button click.The fragment is a dynamic one and we shall replace a Framelayout container with it.Its going to contain a CardView with textviews to show our received data.

Cheers.

Related Tags :
android data passing,android pass data from activity to fragment,android bundle,android intent,activity to fragment,android fragments,android activity,spinner,edittext,programmingwizards tv

Nguồn: https://dorifaucet.com/

Xem thêm bài viết khác: https://dorifaucet.com/cong-nghe/

8 Comments

  • Mohamed Yehia
    Posted July 7, 2020 9:09 pm

    Great Tutorial, how to send listView clicked value from activity to Fragment ?

  • Asif Khan
    Posted July 7, 2020 9:09 pm

    json data fetch in activity and then show in tabview fragment in listview plz any one help me and "but data is show on toast"

  • Nikhil Shende
    Posted July 7, 2020 9:09 pm

    please help me any one how to pass edit text value into spinner..please replay

  • Avisek Mal
    Posted July 7, 2020 9:09 pm

    thanks.

  • shankar mani
    Posted July 7, 2020 9:09 pm

    Hi i want to pass integer value through edittext from activity to fragment how to do that

  • Game Dough
    Posted July 7, 2020 9:09 pm

    Hello

    Can i ask you something.

    I have:
    1 main activity with FAB (Floating Action Button)
    3 fragments with 2 EditText each fragment

    each time the FAB is clicked by user it will calculate data in fragments 1, fragments 2, or fragments 3
    so when fragments 1 is filled with 2 data (2 edittexts) then when the user click the FAB it will knows that fragment 1 has 2 data and need to be calculated.

    So, the question are:
    1. how to use FAB for more than 2 fragments
    2. How to make if statement to figure out which fragment with data input in edittext?

    Thanks
    Nando

  • petealwayslovesu
    Posted July 7, 2020 9:09 pm

    love u

  • Aviator Yonathaniel
    Posted July 7, 2020 9:09 pm

    The much awaited tutorial.Thanks @Oclemmy

Leave a comment