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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:07:09+00:00 2026-05-24T09:07:09+00:00

Passing parameters works with 2 normal activities, but when I try to pass this

  • 0

Passing parameters works with 2 normal activities, but when I try to pass this from the gridview to another activity, the value returns null

First Activity

        gridview.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View v, int position, long id) {

            //This takes the position id of the image and change
            //it to match category id
            position = position + 1;
            String positionId = String.valueOf(position);

            System.out.println(positionId);

            Toast.makeText(MenuActivity.this, "position =" + positionId + "\nid =" + id, Toast.LENGTH_SHORT).show();
            Intent myIntent = new Intent(v.getContext(), MenuItemActivity.class);
            myIntent.putExtra("hello", "hello");
            startActivityForResult(myIntent, 0);


        }
    });

My secondary activity (MenuItemActivity.java)

    public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.menuitem);


    try{
        Bundle extras = getIntent().getExtras();
        String category = null;
        extras.getString("Category "+extras.getString("hello"));
        System.out.println("Category = "+category);
    } catch(Exception e){ 
        System.out.println("Error "+e.getMessage());
    }
  • 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-24T09:07:10+00:00Added an answer on May 24, 2026 at 9:07 am

    from here it looks like a master >> detail page. if so why are you calling

    startActivityForResult(myIntent, 0);
    

    instead of a simple

    startActivity(myIntent);
    

    can you try this and tell me if this works.

    getIntent().getStringExtra("hello");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know that I cannot pass parameters to the Activity constructor in android, but
I'm passing the following parameter as an url fragment to flex. (#groupID=2385) This works
I have inherited a project that uses the following pattern for passing parameters from
This is a follow up to my previous question: Problem passing parameters via Iframe
what is the best practice or best way of passing form parameters from page
After reading another SO thread ( Should parameters/returns of collections be IEnumerable<T> or T[]?
I'm looking for a workaround on passing parameters to a template-match. I'm aware this
If I call $this->url() from a view I get the url with parameters. Ex:
I'm looking for a little help on programmatically passing parameters to a SSRS report
I have a new action in my controller that I'm passing parameters into so

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.