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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:04:23+00:00 2026-06-13T19:04:23+00:00

Question is simple, I am not exactly new to Android but I cannot, for

  • 0

Question is simple, I am not exactly new to Android but I cannot, for the life of me, retrieve the extras passed via an intent from Activity A to Activity B.

See Activity A: This is actually a ListFragment, that implements onListItemClick() to start another activity via an intent.

@Override 
public void onListItemClick(ListView l, View v, int position, long id) {
    Log.i("FragmentList", "Item clicked: " + id); 
    Intent i = new Intent(getActivity(), ExpandedTweetView.class);
    twitter4j.Status status = adapter.getItem(position);

    Bundle extras = new Bundle();
    extras.putString(KEY_TEXT, status.getText());
    extras.putString(KEY_HANDLE, status.getUser().getScreenName());
    extras.putString(KEY_NAME, status.getUser().getName());
    extras.putString(KEY_TIMESTAMPS, status.getCreatedAt().toString());
    extras.putLong(KEY_RETWEETS, status.getRetweetCount());

    i.putExtra(KEY_EXTRAS, extras);
    startActivity(i);
}

This part just works, I tested it usng Log.v(TAG, “status.getText()” to make sure that the error was not coming from the Adapter passing an empty item via getItem().

Here is the code on Activity B:

public class ExpandedTweetView extends Activity {

TextView text;
TextView name;
TextView handle;
TextView createdAt;
TextView retweets;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.expanded_list_item);

    Bundle extras = getIntent().getExtras();

    ActionBar actionBar = getActionBar();
    actionBar.setHomeButtonEnabled(true);
    actionBar.setDisplayHomeAsUpEnabled(true);

    text = (TextView) findViewById(R.id.h_content);
    name = (TextView) findViewById(R.id.h_name);
    handle = (TextView) findViewById(R.id.h_handle);
    createdAt = (TextView) findViewById(R.id.h_timestamp);
    retweets = (TextView) findViewById(R.id.h_retweet_count);

    if(extras != null) {
        text.setText(extras.getString(TimelineFragment.KEY_TEXT));
        name.setText(extras.getString(TimelineFragment.KEY_NAME));
        handle.setText(extras.getString(TimelineFragment.KEY_HANDLE));
        createdAt.setText(extras.getString(TimelineFragment.KEY_TIMESTAMPS));
        retweets.setText(String.valueOf(extras.getLong(TimelineFragment.KEY_RETWEETS)));
    }
}

As you can see, I believe I am using the right code to obtain the extras, using the same code on other applications worked. Not sure why, when the ExpandedTweetView is created via an intent, ALL of the textViews are empty. See: https://www.dropbox.com/s/pso6jbyn6rpks9n/empty_activity.png

What is even MORE strange is that I had initially tried checking to see if the bundle was null by calling this:

if (extras == null) {
Log.v(TAG, "Extras are empty :(");
}

But that line was never executed, meaning the bundle is not null. I also thought that maybe the keys being used to retrieve the individual Strings from the bundle were mismatching; however, in order to remedy that I decided to create constants that could be used on both sides. As you can see on the code, both the key to set the Extra and the Key to retrieve the Extra are the same.

Any ideas as to what the heck is going on?

  • 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-13T19:04:25+00:00Added an answer on June 13, 2026 at 7:04 pm

    Try adding the extra variable to intent rather than in Bundle
    Ex:

     i.putExtra(KEY_1, a);
     i.putExtra(KEY_2, b);
     i.putExtra(KEY_3, c); 
    

    Then retrieve it from other activity from intent
    Ex:

      getIntent().getStringExtra(KEY_1) ;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A really simple question but I could not figure it out... I tried to
I have a simple question but was not able to find an answer on
Its a simple question, but I'm not aware of the answer and I couldn't
I think this is a simple question, but I can not find the answer
This might be a simple question, but I moved one of my apps from
Simple question, the answer may not be... I'm going to be developing a web
I have a simple question whose answer seems not to be in the official
It is a simple question to which I am not able to find the
I have a simple question, not able to sort it out. I have a
I had an interview and a question that seems really simple was not clicking

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.