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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:52:26+00:00 2026-05-20T10:52:26+00:00

It’s quite hard to get my problem across but here goes. I have one

  • 0

It’s quite hard to get my problem across but here goes.

I have one activity Activity 1 which from this I can open one of three activities Activity 2, Activity 3 and Activity 4, of which I want a result to come from Activity 3. Within each of these activities I can create a new intent to open any of the other activities, in turn calling finish() on the current activity.

I have the code working for when I open Activity 3 from Activity 1 and then press the button to finish Activity 3 it sends the message perfectly. My problem lies in say opening Activity 2 from Activity 1 then from Activity 2 opening Activity 3 (in turn calling finish() on Activity 2) and then pressing the button in Activity 3 and sending the same message to Activity 1. At the moment the result code sent through is 0, when I am trying to get it to send the result code ‘726’.

In summary I want to be able to send messages from an Activity created from an intent from an unknown level of other Activities, but the message always goes back to the same lowest level Activity if that makes sense.

I am sorry if this is hard to understand and I hope somebody can help me

  • 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-20T10:52:27+00:00Added an answer on May 20, 2026 at 10:52 am

    I hate answering my own questions but I figured it out anyway for anybody else looking for the answer:

    From the Main Activity

     public void onClick2Activity(View v){
                Intent i = new Intent();
                i.setClass(1Activity.this, 2Activity.class);
                startActivityForResult(i, 0);
            }
    
    @Override
        protected void onActivityResult(int requestCode, int resultCode, Intent data) {
            super.onActivityResult(requestCode, resultCode, data);
            if(resultCode==726){
                Bundle bundle = data.getExtras();
                int string = bundle.getInt("test");
                Log.v("Extra", "" + string);
                Toast.makeText(this, "Pass", Toast.LENGTH_LONG).show();
            }
            else{
                Toast.makeText(this, "Fail", Toast.LENGTH_LONG).show();
            }
        }
    

    From 2Activity:

        public void onClick3Activity(View v){
                Intent i = new Intent();
                i.setClass(2Activity.this, 3Activity.class);
                startActivityForResult(i, 1);
            }
    
        @Override
        protected void onActivityResult(int requestCode, int resultCode, Intent data) {
            super.onActivityResult(requestCode, resultCode, data);
            if(resultCode==726){
                Intent in = new Intent();
                in.putExtra("test", "test");
                setResult(726,in);
                finish();
            }
            else{
                Log.v("Failed", "Failed");
            }
        }
    

    From 3Activity:

    public void onItemClick(){ 
        Intent in = new Intent();
        weaponID = position  + 1;
        in.putExtra("test", "test");
        setResult(726,in);
        finish();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This could be a duplicate question, but I have no idea what search terms
I have a text area in my form which accepts all possible characters from
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have an autohotkey script which looks up a word in a bilingual dictionary

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.