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

  • Home
  • SEARCH
  • 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 7010531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:00:11+00:00 2026-05-27T22:00:11+00:00

When considering the case with android activity, the first method to work is its

  • 0

When considering the case with android activity, the first method to work is its onCreate method..right?

Suppose i want to pass 2 parameters to android activity class say UserHome . For that am creating the constructor of activity class UserHome and accepting the params.

But when we are calling an activity we are not initializing the Activity class, we are just creating an intent of UserHome class.

Then how can we pass params to that activity from another activity without using intent.putExtra("keyName", "somevalue"); usage.

Experts please clarify how we can cover a situation like this.?

  • 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-27T22:00:12+00:00Added an answer on May 27, 2026 at 10:00 pm

    Not sure why you would not want to use the intent params. That is what they are there for. If you need to pass the same parameters from different places in your application, you could consider using a static constructor that builds your intent request for you.

    For example:

    /**
     * Sample activity for passing parameters through a static constructor
     * @author Chase Colburn
     */
    public class ParameterizedActivity extends Activity {
    
        private static final String INTENT_KEY_PARAM_A = "ParamA";
    
        private static final String INTENT_KEY_PARAM_B = "ParamB";
    
        /**
         * Static constructor for starting an activity with supplied parameters
         * @param context
         * @param paramA
         * @param paramB
         */
        public static void startActivity(Context context, String paramA, String paramB) {
            // Build extras with passed in parameters
            Bundle extras = new Bundle();
            extras.putString(INTENT_KEY_PARAM_A, paramA);
            extras.putString(INTENT_KEY_PARAM_B, paramB);
    
            // Create and start intent for this activity
            Intent intent = new Intent(context, ParameterizedActivity.class);
            intent.putExtras(extras);
            context.startActivity(intent);
        }
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
    
            // Extract parameters
            Bundle extras = getIntent().getExtras();
            String paramA = extras.getString(INTENT_KEY_PARAM_A);
            String paramB = extras.getString(INTENT_KEY_PARAM_B);
    
            // Proceed as normal...
        }
    }
    

    You can then launch your activity by calling:

    ParameterizedActivity.startActivity(this, "First Parameter", "Second Parameter");

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

Sidebar

Related Questions

Considering the following case in C#: class Foo { public Foo() { } }
Considering the class below - can I do anything to implement a case-insensitive string?
Considering the following Scala snippet: case class Foo(v1: String, v2: Int, v3: Any) def
I'm considering rolling my own, but just in case there's a good piece of
Considering such code: class ToBeTested { public: void doForEach() { for (vector<Contained>::iterator it =
Considering private is the default access modifier for class Members, why is the keyword
I have an odd sorting case I'm struggling to work out using LINQs GroupBy
What reasoning exists behind making C# case sensitive? I'm considering switching from VB.NET to
Considering the cost, are these cases the same? // case 1 int a =
The case: I have a form class which handles HTML forms, cleans up fields

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.