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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T21:25:31+00:00 2026-06-01T21:25:31+00:00

I know there are questions like: android-intent-bundle-always-null and intent-bundle-returns-null-every-time but there is no correct

  • 0

I know there are questions like:
android-intent-bundle-always-null and intent-bundle-returns-null-every-time but there is no correct answer.

In my Activity 1:

public void goToMapView(Info info) {
    Intent intent = new Intent(getApplicationContext(), MapViewActivity.class);
    //intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
    intent.putExtra("asdf", true);
    info.write(intent);
    startActivity(intent);
}

In Info:

public void write(Intent intent) {
    Bundle b = new Bundle();
    b.putInt(AppConstants.ID_KEY, id);
    ... //many other attributes
    intent.putExtra(AppConstants.BUNDLE_NAME, b);
}
public static Info read(Bundle bundle) {
    Info info = new Info();
    info.setId(bundle.getInt(AppConstants.ID_KEY));
    ... //many other attributes
    return info;
}

In MapViewActivity (Activity 2):

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.map_view);

    Bundle extras = getIntent().getBundleExtra(AppConstants.BUNDLE_NAME);
    info = Info.read(extras);
    ...
}

Problem is that extras bundle is always null. I have debugged it and Intent (intent = getIntent()) has all fields set to null except one indicating what class this is (MapViewActivity).

I’ve also tried putting the bundle via intent.putExtras(b) with the same effect.
The intent.putExtra("asdf", true) is for debugging reasons only – I cannot get this data too (because getIntent() has almost all fields set to null).

EDIT

The answers below are correct and working. This was my fault. I didn’t correctly passed my bundle to new intent.

  • 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-01T21:25:32+00:00Added an answer on June 1, 2026 at 9:25 pm

    I am not sure what “Info” is for, but I suggest making the most basic passing of data from one activity to another first before involving other data objects.

    Activity1

        Intent intent = new Intent(Activity1.this, Activity2.class);
        intent.putExtra("asdf", true);
        info.write(intent);
        startActivity(intent);
    

    Activity2

        Bundle bundle = getIntent.getExtras();
        if (bundle!=null) {
            if(bundle.containsKey("asdf") {
                boolean asdf = bundle.getBooleanExtra("asdf");
                Log.i("Activity2 Log", "asdf:"+String.valueOf(asdf));
            }
        } else {
            Log.i("Activity2 Log", "asdf is null");
    
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know there are already many questions like mine but I found no answer
I know there's no one answer to this question, but I'd like to get
I know there are LOT of questions like that but I can't find one
There are similar questions like this uptill Android 2.3 sdk on Stackoverflow. But as
I know there are a lot of questions like this on the forums, but
I know there are questions similar to this one, but I've not found a
I know there are many questions similar but any of them didn't help. in
NOTE: I know there are many questions that talked about that but I'm still
developing for Android phone(ver 1.5) I would like to know if there is an
I am wondering that does every brand out there whose manufacturing android phones like

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.