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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:46:50+00:00 2026-05-25T02:46:50+00:00

I am running into a problem with my application that I cannot seem to

  • 0

I am running into a problem with my application that I cannot seem to figure out.

The application has a service that starts when the phone starts, or if it has been stopped, starts when the main activity is run before everything else is done.

In the activity’s onCreate I have:

serviceIntent.setClass(this, Service.class);
bindService(serviceIntent, mConnection, Context.BIND_AUTO_CREATE);
startService(serviceIntent);
WriteDisplay();

public void WriteDisplay(){
TextView t = (TextView)findViewById(R.id.tv1);
String strdisplay = Service.getDisplay();
t.setText(strdisplay);
}

In the Service I have:

    @Override 
public void onCreate(){
    super.onCreate();
    GetSettings();

}
public static String getDisplay() {
    return display;
}

GetSettings populates the value of display that is returned in getDisplay() from a settings.xml file.

However when I load up any code in the activity it simply fails and returns nothing but null values.

I have a refresh button on the screen that invokes DrawCanvas(); again, and if I hit the refresh button it is able to grab all the variables properly and processes the code.

I don’t understand why the variables are not loaded on the first run of the activity, but loads properly when I hit the refresh button.

  • 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-25T02:46:50+00:00Added an answer on May 25, 2026 at 2:46 am

    Binding to a service is an asynchronous operation. You have to wait until the binding is finished and then call service methods. Take a look at ServiceConnection.onServiceConnected() method. It has an IBinder argument. When this method is called you can cast binder to its actual type and call its methods.

    Here’s a guide to developing bound services: http://developer.android.com/guide/topics/fundamentals/bound-services.html

    You should read it carefully and implement your service in a similar way.

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

Sidebar

Related Questions

Here is the problem I'm running into. There's a huge legacy application that runs
I'm running in to a problem that I was able to fix with Application.DoEvents,
I'm building my first Facebook Connect application, and am running into an odd problem.
Running into a problem where on certain servers we get an error that the
Been running into this problem lately... When debugging an app in VS.Net 2005, breakpoints
I'm running into a problem setting up my development environment. I've been working on
I've been running into this problem with Flex for nearly a year, and each
Running into a problem. I have a table defined to hold the values of
I am currently running into a problem where an element is coming back from
I am converting a large VC++ 6.0 application to VS2010 and keep running into

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.