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 8981019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:13:47+00:00 2026-06-15T20:13:47+00:00

I cannot seem to change the text in a textview that is in an

  • 0

I cannot seem to change the text in a textview that is in an fragment from my fragmentActivity. Additionally I have tried frag.getView().findViewById which while I would think is the right way to do it, returns null and throws a nullpointer exception.

If I write methods in the Fragment itself to set the text and use getView(), I also get nullpointer exceptions.

Also of note, the first fragment loaded, called by the fragment:name, loads and populates text with this same code. It only does not work after FragmentTransaction.replace() has been called

The code below does not throw any exceptions, however the text remains blank.

public void onTabSelected(Tab tab, FragmentTransaction ft) {
    if(tab.getTag().equals("info")) {
        DisplayEventInfoFragment frag = new DisplayEventInfoFragment();
        ft.replace(R.id.detailsfragment, frag);
        final TextView mTimeView = (TextView)findViewById(R.id.ievent_title);
        final TextView mVenueView = (TextView)findViewById(R.id.ievent_venue);
        final TextView mDescView = (TextView)findViewById(R.id.ievent_description);
        mTimeView.setText(thisEvent.get("theTime")+" - "+thisEvent.get("endTime"));
        mVenueView.setText(thisEvent.get("venue"));
        mDescView.setText(thisEvent.get("description"));

    } else if(tab.getTag().equals("location")) {
        //DisplayEventMapFragment frag = new DisplayEventMapFragment();
        //ft.replace(R.id.detailsfragment, frag);
    }

}
  • 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-15T20:13:48+00:00Added an answer on June 15, 2026 at 8:13 pm

    When querying the main View or any sub Views of a Fragment, you must wait until Fragment.onCreateView() has been called.

    It seems odd that the parent Activity is responsible for modifying layout components of Fragments. One of the main advantages of using Fragments is that they can be self contained and reused throughout your application.

    Perhaps a more viable approach would be to override onActivityCreated() or onStart() of your Fragments (which are called after onCreateView()), and have them populate their TextViews there.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I cannot seem to find a way to have LINQ return the value from
I have encountered an issue that I cannot seem to work out in regards
I cannot seem to get the value from a select option that has been
I have some embarrassingly elementary questions that I cannot seem to find a an
I have quite a complex problem that I cannot seem to solve. I have
I have a problem that I cannot seem to find a solution for. I
OK, so I cannot seem to be able to change the global variable of
I cannot change the height of my div with CSS. It does not seem
cannot seem to find a way to get change or focusout to fire for
My boss has asked for a page that will not change to have two

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.