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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:01:17+00:00 2026-06-15T11:01:17+00:00

I am trying to pass a long value from intent of one class to

  • 0

I am trying to pass a long value from intent of one class to another. But Somehow I dont seem to get the syntax or method to do so. This would solve 90% of my problem. Passing it from a method called intentfunction(setid) in the MainActivity.java to a received intent in SelectOptions.java.

/–MainActivity.java—/

private void intentfunction(long setid)
{
     Intent intent = new Intent(this, SelectOptions.class);
     //editText = (EditText) findViewById(R.id.editText1);
     //editText = new EditText(this);
     etGWid.setText("");   //set the edit text to blank
    //String message = "TestHello";

    intent.putExtra(EXTRA_MESSAGE, setid);
    startActivity(intent);

}

SOmething like the above i wish to implement. And here goes the received part of Selectoptions.java

final Intent intent = getIntent();
    //String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE);
    long getid = intent.getLongExtra(MainActivity.EXTRA_MESSAGE, defaultValue)

Something 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-06-15T11:01:18+00:00Added an answer on June 15, 2026 at 11:01 am

    You have passed your intents correctly, now in the receiving activity to get the intent you could use bundles,

    Bundle extras = getIntent().getExtras(); 
    if (extras != null) {
        long getid = extras.getString('KEY',default_value);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying pass class as value in hashmap. I need to get the
I am trying to pass a ruby array from one C function to another
i am trying to pass some data from my notification intent to one of
Hi I am trying to pass my ArrayList value into my TabLayout but I
I trying to get a value off a spinner and then pass it onto
I'm trying to pass some lat/long values from a JSON doc to iPhone's Map
Umm, well im trying to pass an long that is extracted from a calendarview
I'm trying to pass a value from an android spinner selection into a url.
hi im trying to pass string values that a user enters from one activity
im trying to pass two parameters to a function, i being an int value

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.