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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:10:02+00:00 2026-05-26T14:10:02+00:00

I have this code : Button groupsButton = (Button)findViewById(R.id.groupsButton); groupsButton.setOnClickListener(new OnClickListener() { public void

  • 0

I have this code :

    Button groupsButton = (Button)findViewById(R.id.groupsButton);
    groupsButton.setOnClickListener(new OnClickListener() 
    {
        public void onClick(View v)
        {
            Intent myintentGroups=new Intent(CreateMessageActivity.this, GroupsActivity.class).putExtra("<StringName>", "Value");
            startActivityForResult(myintentGroups, 3);
        }
    });

and now I want to write the onActivityResult, I tried adding this code inside the onClick but it’s not working (Eclipse gives me an error):

@Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        // TODO Auto-generated method stub
        super.onActivityResult(requestCode, resultCode, data);
        String result_string=data.getStringExtra("<StringName>");
    }

Is the code for writing onActivityResult wrong or maybe I’m putting it in the wrong place ?

** Edit : ** the code :

        Button groupsButton = (Button)findViewById(R.id.groupsButton);
    groupsButton.setOnClickListener(new OnClickListener() 
    {
        public void onClick(View v)
        {
            Intent myintentGroups=new Intent(CreateMessageActivity.this, GroupsActivity.class).putExtra("<Came From Create Message>", "Value");
            startActivityForResult(myintentGroups, 3);
        }
    });

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        // TODO Auto-generated method stub
        super.onActivityResult(requestCode, resultCode, data);
        String result_string=data.getStringExtra("<StringName>");
    }

Edit 2: The errors:
Multiple markers at this line
– Syntax error on token “(“, ; expected
– void is an invalid type for the variable
onActivityResult
– Syntax error on token “)”, ; expected
– Syntax error on token “,”, ; expected
– Syntax error on token “,”, ; expected

  • 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-26T14:10:03+00:00Added an answer on May 26, 2026 at 2:10 pm

    onActivityResult should be placed in the Activity class that contains the onClick not in the actual onClick. The CreateMessageActivity.this in the new Intent will indicate which activity the result should be returned to.

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

Sidebar

Related Questions

I have this code in my view.. <div> <input type=button value=Cancel id=btnCancel onclick=window.location.href='../Reviewer' />&nbsp;<input
I have this code: public class VoiceActivity extends Activity implements OnClickListener { private TextView
So I have this javascript code onclick of button for a child window which
I have this code to check/uncheck a radio button onclick. I know it is
I have this code: <a href=# class=button id=buyme ></a> <a href=# id=buy onclick=placeOrder('10');return false;><span
I have this code that has one button that let's me choose an entry
I have this code in the end of link button click: Response.ContentType = application/zip;
Here's my problem - I have some code like this: <mx:Canvas width=300 height=300> <mx:Button
I have this jquery code: $(.button-banc).hover(function() { $(.button-banc img) .animate({ top: -21px }, 200).animate({
So far I have this code run when the X button is clicked, 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.