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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:42:05+00:00 2026-06-05T14:42:05+00:00

I’m simply trying to carry a string onto the next activity without having to

  • 0

I’m simply trying to carry a string onto the next activity without having to define an entire object for the task. I’ve seen similar solutions and gotten them to work BUT without using AsyncTask to create the intent.

protected void onPostExecute(Boolean result) {
        if (loggedIn && hasPin) {

            Intent intent = new Intent(UniteActivity.this,
                    WebViewActivity.class);
            intent.putExtra(PASSED_USERNAME, passUser);
            startActivity(intent);
        }
        if (loggedIn && !hasPin) {

            Intent intent = new Intent(UniteActivity.this,
                    CreatePinActivity.class);
            intent.putExtra(PASSED_USERNAME, passUser);
            startActivity(intent);

PASSED_USERNAME is a public static constant to hold the package name, just as the putExtra() method requires. I then try to pull the value out in the next activity.

Intent extras = getIntent();

            String username = extras.getStringExtra(UniteActivity.PASSED_USERNAME);

            // carry username to next activity
            Intent intent = new Intent(CreatePinActivity.this,WebViewActivity.class);
            intent.putExtra(PASSED_USERNAME, username);
            startActivity(intent);

There is never a String to pull out, the value of username is always null. I’ve gone through the debugger and found that the Eclipse IDE debugger shows different intent ID’s between the activities, they are never consistant. Is it possible that AsyncTask is interfereing somehow because it splits into a seperate thread?

  • 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-05T14:42:07+00:00Added an answer on June 5, 2026 at 2:42 pm

    I don’t know if this applies to your problem, because I can’t see from your code snippet if the intermediary activity is freshly created or not.

    BUT: the getIntent()-method always returns the first Intent that started the activity. If the activity remains in the background and receives a new Intent this value does not get updated automatically. You have to override onNewIntent(...) and manually call setIntent(...) for this to work (or do all your stuff directly there).

    So just for the case that you do not run your posted code in the onCreate() method please check if you did not miss to fetch the real intent you are interested in.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
i got an object with contents of html markup in it, for example: string
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
Specifically, suppose I start with the string string =hello \'i am \' me And

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.