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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:23:50+00:00 2026-05-27T16:23:50+00:00

I managed to have a button and then when I click on it, I

  • 0

I managed to have a button and then when I click on it, I go to a new activity that is called “TUTORIALONE”

and then I want to display some text in this new activity

so I have something like this

   Button b = (Button) findViewById(R.id.tutorial1);
        b.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {

            startActivity(new Intent("my.android.TUTORIALONE"));
            TextView tv = (TextView)findViewById(R.id.tutorial1);
                    tv.setText("this is some text);

        }
    });

the problem is that it first displays the text on my button, and then it shows me the new activity, how would I achieve displaying the text on the new activity?

thanks in advance

  • 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-27T16:23:50+00:00Added an answer on May 27, 2026 at 4:23 pm

    In your TUTORIALONE activity you probably have an associated xml file for displaying content. Perhaps it iss set something like this

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
      super.onCreate(savedInstanceState);
      setContentView(R.id.TUTORIALONE);
    }
    

    In the layout xml file for TUTORIALONE just add something like this

    <TextView android:id="@+id/text"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:text="Hello, I am a TextView" />
    

    EDIT

    To change the text of this TextView, do something like this in your TUTORIALONE activity.

    protected void onStart()
    {
        super.onStart();
        TextView tv = (TextView)findViewById(R.id.text);
        tv.setText("this string is set dynamically from java code");
    }
    

    Note that the id here (R.id.text) is the same as in the xml file (“@+id/text”)

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

Sidebar

Related Questions

I want to click a button, have a text input box show up and
So far I have managed to write some code that should print the source
I've deconstructed a standard WPF button using Blend and have managed to create a
Struggling with styling the mouse over for a button ... I have managed to
Im having a problem, I have managed to get some code to make a
I have managed to setup a page so that a user clicks an item
The problem I'm having is that in my brand new project I have a
I am using ASP.NET MVC 3. I have an action method called New. When
I have an app that plays radio stations, and I now want to integrate
I have an application. I want to release this app in android market for

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.