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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:02:26+00:00 2026-06-01T11:02:26+00:00

I have 2 Tabs – Tab1 and Tab2, Tab1Activity and Tab2Activity. I want to

  • 0

I have 2 Tabs – Tab1 and Tab2, Tab1Activity and Tab2Activity.
I want to pass values from Tab1Actvity to Tab2Activity but dont want to start Tab2Activity.
When i try below code it gives null value:

In Tab1Activity

getParent().getIntent().putExtra("key", "value");

In Tab2Activity

String valueString=getParent().getIntent().getStringExtra("key");
System.out.println("Testing.....: "+valueString);
  • 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-01T11:02:27+00:00Added an answer on June 1, 2026 at 11:02 am

    I really discourage you from using global variables by extending the Application class. If your application goes to the background, (e.g. due a phone call) the android system might decide to kill your application. When the call is finished your application and the activity stack will be restored, but your activity state will be lost.

    I’d rather suggest you to use broadcasts to send data to another activity.

    In your Tab1Activity:

    Intent dataIntent = new Intent();
    dataIntent.setAction("com.your.app.DATA_BROADCAST");
    dataIntent.putExtra("tag", "your data");
    sendBroadcast(dataIntent);
    

    Tab2Activity:

    BroadcastReceiver receiver = new BroadcastReceiver() {    
      @Override
      public void onReceive(Context context, Intent intent) {    
        String yourData = intent.getStringExtra("tag");
      }
    };
    
    IntentFilter filter = new IntentFilter();
    filter.addAction("com.your.app.DATA_BROADCAST");
    registerReceiver(receiver, filter);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I want to have tabs with default style but I want to handle
I have a tabs on a page: <div id=tabs> <ul> <li><a href=#tabs-1>tab1</a></li> <li><a href=#tabs-2>tab2</a></li>
I have some tabs using jQuery UI which work just fine, but I want
I have tabs activities. one activity gets data from local database, but when I
I have jquery tabs on my website but on smaller screens the tabs wrap
I using Jquery tabs plugin to have tabs in my view. I want <li><a
I have the tabs code working but on page load all the tabs are
I have tabs setup, Which animate on hover. What I want to do is
I have tabs on my website, but sometimes the tab doesn't contain any info
I have tabs in JavaFX and I want to set a style to remove

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.