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

  • Home
  • SEARCH
  • 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 4265148
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T06:35:04+00:00 2026-05-21T06:35:04+00:00

I have a log in page that pulls information from a data base, I

  • 0

I have a log in page that pulls information from a data base, I then want to use this some of this information to populate different textviews on a new page/activity. I can get a textview to change on the activity where I have my submit button, but when I try to change the textview on my second activity, it just crashed (The application has stopped unexpectedly).

Here’s my code for changing the textview (where txtID is my textview on a separate activity)

TextView test2 = (TextView) findViewById(R.id.txtID);
test2.setText(test);

my xml for seperate activity

<TextView android:text="TextView" android:id="@+id/txtID"
android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>

Oh, I’m using a tableview for my login page, then tabs for my the rest of my pages. I’m pretty new to this, so sorry if this is something simple, but any help would be greatly appreciated!! 🙂

  • 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-05-21T06:35:05+00:00Added an answer on May 21, 2026 at 6:35 am

    You don’t want to directly touch the UI elements of another Activity. You can make use of bundles to pass information back and forth. Here is an example:

    Say we have Activity A, and it has some information as a String it wants to pass to become the text of a TextView in Activity B.

    //Setup our test data
    String test = "Some text";
    //Setup the bundle that will be passed
    Bundle b = new Bundle();
    b.putString("Some Key", test);
    //Setup the Intent that will start the next Activity
    Intent nextActivity = new Intent(this, ActivityB.class); 
    //Assumes this references this instance of Activity A
    nextActivity.putExtras(b);
    
    this.startActivity(nextActivity);
    

    So now in the onCreate method for Activity B, we can get that String and assign it as the text to the TextView like you have

    public void onCreate(Bundled savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main); //Setup some layout, set to your own
    
        String test = getIntent().getExtras().getString("Some Key");
        TextView test2 = (TextView) findViewById(R.id.txtID);
        test2.setText(test);     
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a internal website that users log into. This data is saved as
I have a log in page where I valid my users and based on
I have this: public string Log { get { return log; } protected set
I have a div in a page that I can't select with jQuery. I've
We have an internal ASP.NET MVC application that requires a logon. Log on works
I've got this page that calls: FB.Connect.requireSession(callback) and in the callback are all the
I have a script that appends some rows to a table. One of the
I have an app that successfully uses Facebook's single sign on to log a
I have constructed an XSL file that parses an XML formatted log and generates
I have a method that pulls a url name(varchar), a urlID(int) and its Enabled

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.