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

  • Home
  • SEARCH
  • 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 6975615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:23:28+00:00 2026-05-27T17:23:28+00:00

This is my short description about my widget and main application. Sorry because of

  • 0

This is my short description about my widget and main application. Sorry because of my English (English is not my mother tongue)

I have a music player widget. When this widget enabled, I need bind to a music player service (A) of main application. Because we cannot bind a service in AppWidgetProvider so I start a local service (B) in AppWidgetProvider and bind to that music player service (A) from here. Furthermore, I also have a service C to do widget’s button function.

Everything seems to be working fine but when my main app with service A all forced stop (they will be restating a moment later) I must rebind to A from widget. Problem is when main app was forced stop, I cannot rebind to A because context(I stored Context as a global variable in AppWidgetProvider whenever I receive context from onEnabled, onUpdate) is NULL.

My question is how about my above widget structure? Should service B stoped when bind to A done? How can i bind to service A again when main app and service a was forced stop (but they will automatically restart a moment later).

Thanks you!

  • 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-27T17:23:28+00:00Added an answer on May 27, 2026 at 5:23 pm

    Answer my own question

    1. First, We can bind Service from widget, using context.getApplicationContext().bindService(..)
    2. When main application was forced stop, to bind service again on onUpdate() use application context MyMainApplication.Instance().getApplicationContext().bindService(..)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm starting out with Backbone.JS, and have a question about how this should work.
Short description of my problem: I start up Tomcat with my deployed Wicket application.
I am working on a short application. In which I have followiing things. move
A simple question that I'm not sure if it has a short answer! Description
So I wrote this short script (correct word?) to download the comic images from
I'll make this short, I got this webpage : <html xmlns=http://www.w3.org/1999/xhtml> <head> <link rel=Stylesheet
To help me better understand lambda I wrote this short snippet that rotates and
Ok, I'll try and keep this short, sweet and to-the-point. We do massive GeoIP
This is a short question. At some point my thread understand that it should
In short: For this code: Encoding.ASCII.GetBytes(‚) I want the output to be 130, but

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.