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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:32:11+00:00 2026-06-15T04:32:11+00:00

So i have a simple Question , it is Possible to Handle the Method

  • 0

So i have a simple Question , it is Possible to Handle the Method onActivityResult() in a Service if this Activity was Started from the Same Service (Using Intent) ?

In My Case , i want to start SpeechRegnition , Speak , and Get the Result on the Service , Everything on Background (Main Service Start from a Widget) ,

Thanks .

  • 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-15T04:32:12+00:00Added an answer on June 15, 2026 at 4:32 am

    Thanks for a recent downvoting, whoever it was. The previous answer I gave back in 2012 is a total nonsesnse so I decided to write a proper one.

    You can not handle Activity result in a Service, but you can pass any data retrieved from onActivityResult() to a Service.

    If your Service is already running, you can call startService() with a new Intent handling the event, like so

    @Override
    public void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == CODE && resultCode == RESULT_OK) {
            notifyService(data);
        }
    }
    
    private void notifyService(final Intent data) {
        final Intent intent = new Intent(this, MyService.class);
        intent.setAction(MyService.ACTION_HANDLE_DATA);
        intent.putExtra(MyService.EXTRA_DATA, data);
        startService(intent);
    }
    

    And handle action in a Service. If it is already running it will not be restarted, otherwise it will be started

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        if (intent != null) {
            final String action = intent.getAction();
            if (action != null) {
                switch (action) {
                    case ACTION_HANDLE_DATA:
                        handleData(intent.getParcelableExtra(EXTRA_DATA));
                        // Implement your handleData method. Remember not to confuse Intents, or even better make your own Parcelable
                        break;
                }
            }
        }
        return START_NOT_STICKY;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Check if a variable is empty Simple PHP question: I have this
I have a simple question Is it possible to download a specific resource file
I have a very simple question: Is it possible to change the price of
I've only have a simple question to ask : Is it possible to call
I have a (hopefully) simple question. Is it possible to use SSHD tunneling to
Possible Duplicate: c++ virtual function return type I have a simple but confusing question
i have a simple question: i have this var: $v = 24000,1500,1500,1500,1500,1500,; i would
This is seems like a pretty simple question. Is it possible to set a
This seems like a fundamentally simple question. I have a WinForms dialog box with
I have a simple Java questions and I need a simple answer, if possible.

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.