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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:45:36+00:00 2026-05-26T08:45:36+00:00

I am trying to send a bundle from one activity to another. When I

  • 0

I am trying to send a bundle from one activity to another. When I load the bundle in the recieving activity all the information seems to be null. Here is some code:

Activity A (sending bundle):

public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
                Intent intent = new Intent(HotelsActivity.this, EditHotelActivity.class);
                Bundle b = new Bundle();
                b = toBundle(app.getHotelList().get(position));
                intent.putExtra("Hotel Bundle", b);
                startActivity(intent);
            }

            });

the toBundle method is just adding strings from an object into the bundle. I have put logging statements in this method and the bundle is definately not null.

Activity B (loading the bundle):

public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView (R.layout.edit_hotel);
        setTitleFromActivityLabel (R.id.title_text);

        // Retrieve sent bundle
        Bundle b = this.getIntent().getExtras();
        String hotelName = b.getString("hotelname");
        if (hotelName == null)
            MyLog.i(TAG, "IT IS NULL");
    }

The loggin statement then prints “IT IS NULL” because for some reason hotelName is null but that is definately the correct key.

Can anyone help with this?

toBundle method:

public Bundle toBundle(HotelItem hotel) {
        Bundle b = new Bundle();
        b.putString("hotelname",hotel.getHotelName());
        b.putString("hotel address", hotel.getHotelAddress());
        b.putString("hotel telephone", hotel.getHotelTelephone());
        b.putString("hotel website", hotel.getHotelWebsite());


        return b;
    }
  • 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-26T08:45:37+00:00Added an answer on May 26, 2026 at 8:45 am

    You must use exact key sent:

    String hotelName = b.getString("hotelname");
    

    Updated!

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

Sidebar

Related Questions

i'm trying to send a byte[] from one activity to another. in the recieving
im trying to send two bundles at once from one activity to another and
I am trying to pull in a string from one activity to another but
I am trying to send some data from a LINQ query in C# to
in my application i'm trying to send an int value from one view to
I'm trying to send a value to the appDelegate from one UIViewController, so that
I'm trying to send objects from bundles over a dedicated communication bundle to an
Trying to send some email in my C# app. I am behind a proxy
im trying to send rest api Users.getLoggedInUser i have all the secret session and
I am trying to send an email from a site I am building, but

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.