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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T01:11:07+00:00 2026-06-17T01:11:07+00:00

From my Android app I wish to launch the default web browser to send

  • 0

From my Android app I wish to launch the default web browser to send the user to a verification web page, and then once verified use a callback to send them back to my app.

I have that functionality working ok, but what I’m having difficulty with is intercepting the situation where the user decides they don’t want to verify themselves in the web browser and clicks the back button to return to my app.

I’ve tried launching the web browser with startActivityForResult() so I can intercept back clicks using onActivityResult(), but for some reason onActivityResult() is called immediately after launching the web browser, and not at all when the user clicks back.

Here’s some basic test code that demonstrates the problem:

public class MainActivity extends Activity
{
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_main);

        Log.i("MainActivity","onCreate called");

        Uri uri = Uri.parse("http://www.google.com");

        Intent intent = new Intent(Intent.ACTION_VIEW,uri);

        startActivityForResult(intent,101);

        Log.i("MainActivity","startActivityForResult called");
    }

    @Override
    public void onResume()
    {
        super.onResume();

        Log.i("MainActivity","onResume called");
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data)
    {
        Log.i("MainActivity","onActivityResult called");
    }
}

Output after running this code:

I/MainActivity(545): onCreate called
I/MainActivity(545): startActivityForResult called
I/MainActivity(545): onResume called
I/MainActivity(545): onActivityResult called
I/MainActivity(545): onResume called

Then if the user clicks back from the web browser, it just calls onResume() a third time.

So given that, would anyone have any suggestion on how I can recognise when the user clicked back from the browser?

  • 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-06-17T01:11:08+00:00Added an answer on June 17, 2026 at 1:11 am

    How about giving this a try:

    @Override
    public void onWindowFocusChanged(boolean hasFocus)
    {
        super.onWindowFocusChanged(hasFocus);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have android app . i should pass the data from android to web
I have a php web service that takes the request from android/iphone app and
I am using oracle db and weblogic as web server. From my android app
I am trying to launch an android app from within eclipse. If my eclipse.ini
I'm trying to send data from my Android app to my PC over TCP.
I wish to download specifica packaged app from Android source, I'm trying: repo init
I need to send image from android app to java app. Basically, I need
Possible Duplicate: Open Facebook page from Android app? when I load a url with
Possible Duplicate: Open Facebook page from Android app? Does the Android Facebook app have
I have a php script that inserts data from an Android app into a

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.