Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8065127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:34:27+00:00 2026-06-05T11:34:27+00:00

I have a Bundle in a fragment that passes a string to another fragment.

  • 0

I have a Bundle in a fragment that passes a string to another fragment. This string needs to set text in a text view and my method isn’t working. I’m not sure why but all my other strings pass thru.

Please take a look at my code and let me know what I have wrong – I don’t get it…

From:

public void onClick(View v) {

        Bundle args = new Bundle();

        FragmentManager fm = getFragmentManager();
        final FragmentTransaction vcFT = fm.beginTransaction();
        vcFT.setCustomAnimations(R.anim.slide_in, R.anim.hyperspace_out, R.anim.hyperspace_in, R.anim.slide_out);

        switch (v.getId()) {

            case R.id.regulatoryBtn :

                String keyDiscriptionTitle = "Regulatory Guidance Library (RGL)";
                args.putString("KEY_DISCRIPTION_TITLE", keyDiscriptionTitle);

                RegulatoryDiscription rd = new RegulatoryDiscription();
                vcFT.replace(R.id.viewContainer, rd).addToBackStack(null).commit();
                rd.setArguments(args);
                break;
. . .
}

To:

public class RegulatoryDiscription extends Fragment {

    Bundle args = new Bundle();

    String DNS = "http://192.168.1.17/";
    String KEY_DISCRIPTION_TITLE = "KEY_DISCRIPTION_TITLE";

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.discription_view, container, false);

        TextView title = (TextView) view.findViewById(R.id.discriptionTitle);
        String keyDiscriptionTitle = args.getString(KEY_DISCRIPTION_TITLE);
        title.setText(keyDiscriptionTitle);

        return view;
    }
 . . .
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T11:34:28+00:00Added an answer on June 5, 2026 at 11:34 am

    You are declaring args as a new Bundle in your RegulatoryDescription Fragment. This will initialize a new Bundle object that is completely empty

    You need to retrieve the already existing arguments that you passed in.

    ex.

    public class RegulatoryDiscription extends Fragment {
        Bundle args;
    
        String DNS = "http://192.168.1.17/";
        String KEY_DISCRIPTION_TITLE = "KEY_DISCRIPTION_TITLE";
      @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
            View view = inflater.inflate(R.layout.discription_view, container, false);
    
            args = getArguments(); //gets the args from the call to rd.setArguments(args); in your other activity
    
            TextView title = (TextView) view.findViewById(R.id.discriptionTitle);
            String keyDiscriptionTitle = args.getString(KEY_DISCRIPTION_TITLE);
            title.setText(keyDiscriptionTitle);
    
            return view;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an int/string(s) that is passed from one fragment to another. For each
I have the current bundle reference working locally: Bundles.Reference(/Content/global.css); On the development site, this
I have a custom Fragment that inflates it's content from test.xml @Override public View
I have a Pager adapter that will call a ListFragment like this: public Fragment
I have created a bundle. However its not working when deployed to production server.
I have an image that I have in my bundle resources that I need
I am using the new System.Web.Optimization and have created a bundle like this: bundles.Add(New
I have a fragment which has its own state (selected buttons, etc). That state
I have a simple fragment activity. In the onCreate() method, I simply add a
I have a fragment class that extends Fragment and calls setHasOptionsMenu to participate in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.