Android: Switching between two activities
<p>I have this code :</p>

<pre><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("&lt;StringName&gt;", "Value");
            startActivityForResult(myintentGroups, 3);
        }
    });
</code></pre>

<p>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):</p>

<pre><code>@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("&lt;StringName&gt;");
    }
</code></pre>

<p>Is the code for writing onActivityResult wrong or maybe I'm putting it in the wrong place ?</p>

<p>** Edit : ** the code :</p>

<pre><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("&lt;Came From Create Message&gt;", "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("&lt;StringName&gt;");
    }
</code></pre>

<p>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</p>
