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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:47:36+00:00 2026-05-31T23:47:36+00:00

the program doesnt call onActivityResult, ive been in many post as this but i

  • 0

the program doesnt call onActivityResult, ive been in many post as this but i cant make it work.

Im using Android 3.0 Emulator.

this is the code of GameScreen.java

@Override 
public void onActivityResult(int requestCode, int resultCode, Intent data) {      
  super.onActivityResult(requestCode, resultCode, data); 
  switch(requestCode) { 
    case 0: { 
      if (resultCode == Activity.RESULT_OK) {    
          String newText = data.getStringExtra("isRunning");          
          // TODO Update your TextView.
          isRunning = true;
      } 
      break; 
    } 
  } 
}
 public void pause(){
    clickListener = new OnClickListener() {         
        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub              
            pause.setImageResource(R.drawable.pauseafter);
            isRunning = false;
            Intent intent = new Intent(Gamescreen.this, Shop.class);                  
            startActivityForResult(intent, 0);
        }
    };
}

this is the code Shop.java

public void returnButton(){
    resume.setOnClickListener(new OnClickListener() {           
        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            Intent intent = new Intent();
            setResult(Activity.RESULT_OK,intent);
            finish();
        }
    });
}   
  • 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-31T23:47:36+00:00Added an answer on May 31, 2026 at 11:47 pm

    To test I’ve created simple application. Nothing fancy, just default layout and two activities. Toast in onActivityResult is shown properly.

    Here’s complete working code:

    file OnReturnActivity.java:

    package some.package;
    
    import android.app.Activity;
    import android.content.Intent;
    import android.os.Bundle;
    import android.widget.Toast;
    
    public class OnReturnActivity extends Activity {
        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
    
            Intent i = new Intent(this, GimmeReturn.class);
            startActivityForResult(i, 0);
        }
    
        @Override
        protected void onActivityResult(int requestCode, int resultCode, Intent data) {
            // TODO Auto-generated method stub
            Toast.makeText(this, "Got Result " + String.valueOf(resultCode),     Toast.LENGTH_SHORT).show();
            super.onActivityResult(requestCode, resultCode, data);
        }
    }
    

    file GimmeReturn.java:

    package some.package;
    
    import android.app.Activity;
    import android.os.Bundle;
    
    public class GimmeReturn extends Activity {
        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
    
            Toast.makeText(this, "Returning!", Toast.LENGTH_SHORT).show();
            setResult(RESULT_OK);
            finish();
        }
    }
    

    Both activities need to be added to Android manifest. Activity OnReturnActivity has action MAIN and category LAUNCHER (and is started as main activity for application). Activity GimmeResult is just added without any IntentFilter.

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

Sidebar

Related Questions

I've been trying to follow this tutorial on using Google Map View in Android.
Why doesn't this work? The program stops on: this.textBox1.Text = (New text); Thread demoThread;
Can someone explain me why the following program doesn't work, and how to make
For some reason the following doesn't crash like my program does, but I'm pretty
If a program has literally just deserialized an object (doesn't really matter how, but
So I have this program that I really like, and it doesn't support Applescript.
I am writing a large C program for embedded use. Every module in this
Ok I understand that this error mostly comes from sending a method call or
whenever I call a GC.Collect() or GC.GetTotalAmountOfMemory(true) the whole program just hangs. Now, I
When adding this code to a simple calculator program I receive the error message

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.